[bug ?] File exists

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: helmut, XnTriq, xnview

Post Reply
User avatar
DOS386
Posts: 291
Joined: Sun Jun 11, 2006 2:43 pm

[bug ?] File exists

Post by DOS386 »

NCONVERT seems to expose a suboptimal / inconsistent / "bad" behavior on "file exists" problem: if a file is to be saved and a file of given name already exists.

- When converting a single image, it "silently" kicks the existing file and leaves the new one instead :-( (YES, I am sensitive to this type of problem, IMHO a BUG :bug:)

- When decomposing an animation and frame files already do exist, it just doesn't save anything and reports success :-(

Suggestion how to fix:

- Consistent behavior for both single image convert and decomposing

- NEVER write to an existing file -> no risk of trouble with "R" attribute ;-)

- Before saving, always check whether file exists - if NO, just save, if YES, try to rename (limit amount of attempts to ... 5 maybe) by incrementing 0th character:

BLAH.BMP -> CLAH.BMP -> DLAH.BMP -> ELAH.BMP-> FLAH.BMP -> still exists ? Give up: Impossible to save "BLAH.BMP" , file exists, renaming didn't help

YEAH.PNG -> ZEAH.PNG -> AEAH.PNG -> ...

photo.jpg -> ... (increment lowercase or UCASE or so)

~#.gif -> A#.gif -> B#.gif -> ...

I deliberately suggest using 0th character, not the last one, nor appending anything (like " BLAH(2).BMP " ) ... end of the filename is "used" for frame decomposition :idea:

This way one could decompose the same animation multiple times, with different options, and get multiple sets of frames:

WOW.PNG (APNG with 3 frames)

Code: Select all

NC -xall -out bmp WOW.PNG
Result: WOW-1.BMP WOW-2.BMP WOW-3.BMP

next attempt:

Code: Select all

NC -xall -out bmp -truecolors WOW.PNG
Result: XOW-1.BMP XOW-2.BMP XOW-3.BMP

and one more:

Code: Select all

NC -xall -out bmp -truecolors -gamma 1.2 WOW.PNG
Result: YOW-1.BMP YOW-2.BMP YOW-3.BMP

Now having 3 x 3 images ready for inspection :idea:
There is indeed no WinZIP under my rock.
Post Reply