-o creates wrong file extension

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

Moderators: XnTriq, xnview

midnightoil
Posts: 3
Joined: Tue Jan 04, 2022 2:22 pm

-o creates wrong file extension

Post by midnightoil »

In resizing a jpeg file, nconvert is ignoring the extension on the original source file and using 'jpg' instead.
For example:

Code: Select all

nconvert -resize longest 150 -o try.jpeg IMG_0132_2.jpeg > /dev/null
Conversion of IMG_0132_2.jpeg into try.jpg OK
The created file is "try.jpg" and not "try.jpeg".

I've tested this with Linux v7.98 and MacOS v6.88.

(The link to download the user guide is broken on the website)

Any suggestions?
cday
XnThusiast
Posts: 3126
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: -o creates wrong file extension

Post by cday »

Although the -o try.jpeg term defines the output filename, I think you may also need a -out JPEG term, although you are not in fact changing the file format... :?:

Otherwise, possibly related to this file extension error? recent unresolved reported issue.
midnightoil
Posts: 3
Joined: Tue Jan 04, 2022 2:22 pm

Re: -o creates wrong file extension

Post by midnightoil »

Thanks, that seems to have fixed it!

It is not obvious from the help info. Might be mentioned in the manual but the link is broken.

Code: Select all

$ nconvert -resize longest 150 -o try.jpeg -out jpeg IMG_0132_2.jpeg > /dev/null
Conversion of IMG_0132_2.jpeg into try.jpeg OK
midnightoil
Posts: 3
Joined: Tue Jan 04, 2022 2:22 pm

Re: -o creates wrong file extension

Post by midnightoil »

Only problem remaining is that it doesn't handle case very well.

Output extension is always lower case (unless it is illegal)

Bad:

Code: Select all

nconvert -resize longest 150 -o thumbs/IMG_0009.JPG  IMG_0009.JPG
Conversion of IMG_0009.JPG into thumbs/IMG_0009.jpg OK

nconvert -resize longest 150 -o IMG_0006.JPEG -out JPEG IMG_0006.JPEG
Bad output format 'JPEG'
Good:

Code: Select all

nconvert -resize longest 150 -o thumbs/IMG_0003.jpeg -out jpeg IMG_0003.jpeg
Conversion of /IMG_0003.jpeg into thumbs/IMG_0003.jpeg OK