file extension error?

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

Moderators: XnTriq, helmut, xnview

tomv
Posts: 21
Joined: Sat Oct 30, 2021 4:33 pm

file extension error?

Post by tomv »

Hi there,
I'm on windows 10, nconvert v7.95

I have a folder with this 2 files:

IMG_4954.JPG
IMG_4954.JPG_original

then exec this command:
.\NConvert\nconvert -o "..\CARPETA_DE_PROCES\%%" -keep_icc -ratio -rtype hanning -rflag decr -resize shortest 1500 -rotate 90 -D -overwrite "..\CARPETA_DE_PROCES\*.jpg " "..\CARPETA_DE_PROCES\*.jpeg "

the problem is that the image "IMG_4954.JPG_original" is unexpectedly processed too. Nconvert is taking the file type not from file extension?

thanks.
best regards
cday
XnThusiast
Posts: 4186
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: file extension error?

Post by cday »

Two thoughts, possibly neither very helpful:

1. With your input term "..\CARPETA_DE_PROCES\*.jpeg " rather than "... *.jpg" I'm surprised that either file is processed!

2. Acceptance of "IMG_4954.JPG_original" as an input filename is possibly not a design case, not anticipated that syntax would be used.
tomv
Posts: 21
Joined: Sat Oct 30, 2021 4:33 pm

Re: file extension error?

Post by tomv »

Hi, thanks for your response. For me seems that nconvert looks the file type inside file instead of on the file extension.
cday
XnThusiast
Posts: 4186
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: file extension error?

Post by cday »

tomv wrote: Fri Dec 10, 2021 9:56 am Hi, thanks for your response. For me seems that nconvert looks the file type inside file instead of on the file extension.
Pierre?
User avatar
xnview
Author of XnView
Posts: 44922
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: file extension error?

Post by xnview »

and if you use

Code: Select all

.\NConvert\nconvert -o "..\CARPETA_DE_PROCES\%%" -keep_icc -ratio -rtype hanning -rflag decr -resize shortest 1500 -rotate 90 -D -overwrite ..\CARPETA_DE_PROCES\*.jpg ..\CARPETA_DE_PROCES\*.jpeg
without "?
Pierre.
tomv
Posts: 21
Joined: Sat Oct 30, 2021 4:33 pm

Re: file extension error?

Post by tomv »

Sorry, I thought I had activated the email notifications and until today I have not seen the message.

Yes, removing "the same thing happens
cday
XnThusiast
Posts: 4186
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: file extension error?

Post by cday »

tomv wrote: Tue Dec 28, 2021 7:31 pm Yes, removing "the same thing happens
Not solved?
tomv wrote: Fri Dec 10, 2021 9:56 am For me seems that nconvert looks the file type inside file instead of on the file extension.
I have tested *.jpg and *.jpeg, and source files are filtered correctly according to their extension...
tomv
Posts: 21
Joined: Sat Oct 30, 2021 4:33 pm

Re: file extension error?

Post by tomv »

hi,

.jpg and .jpg files are correctly processed, the point is that in the directory I hava files with file format "name.JPG_original" that is suposed not to be processed
cday
XnThusiast
Posts: 4186
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: file extension error?

Post by cday »

tomv wrote: Tue Dec 28, 2021 8:01 pm .jpg and .jpg files are correctly processed, the point is that in the directory I hava files with file format "name.JPG_original" that is supposed not to be processed
Agreed that it wouldn't be expected to be processed...

cday wrote: Thu Dec 09, 2021 8:33 pm Acceptance of "IMG_4954.JPG_original" as an input filename is possibly not a design case, not anticipated that syntax would be used?
Seems reasonable, you could possibly try other ways of disabling reading of unwanted files, maybe .xxx for example...
tomv
Posts: 21
Joined: Sat Oct 30, 2021 4:33 pm

Re: file extension error?

Post by tomv »

only Pierre knows for sure, but it seems that the program checks if a file is of the jpg type by reading some attribute and not the extension.

Looking for another way to not process these files? yes, for example I can call the program iteratively for each specific file. But for me it is a thing to fix. Imagine that you have files that you want to keep intact and the program processes them when it was not supposed to ...
cday
XnThusiast
Posts: 4186
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: file extension error?

Post by cday »

tomv wrote: Tue Dec 28, 2021 8:20 pm it seems that the program checks if a file is of the jpg type by reading some attribute and not the extension.
Doesn't the fact that the code correctly distinguishes .jpg and .jpeg show that is not the case?

If you wish to use your existing code you might, as you know how you are operating, change to the extension to .png for example, if you use an extension that isn't recognised the files won't be processed but an error will be reported in the terminal output for each file, may or may not be an issue.

Something like that might provide a workaround pending a possible fix by Pierre, if needed.

tomv wrote: Tue Dec 28, 2021 8:20 pm only Pierre knows for sure...
That should be the case if he considers the issue...
User avatar
xnview
Author of XnView
Posts: 44922
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: file extension error?

Post by xnview »

i can't reproduce, only .jpg/.jpeg are processed... you use terminal to execute this command?
Pierre.
tomv
Posts: 21
Joined: Sat Oct 30, 2021 4:33 pm

Re: file extension error?

Post by tomv »

Hi, I use this instructions in a cmd batch file
cday
XnThusiast
Posts: 4186
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: file extension error?

Post by cday »

Looking at your code, two observations:

Code: Select all

-o "..\CARPETA_DE_PROCES\%%"
In the above term you haven't included a file extension, which I think should be included, although it may not always actually be necessary.

Code: Select all

"..\CARPETA_DE_PROCES\*.jpg " "..\CARPETA_DE_PROCES\*.jpeg "
And in the above terms there is a space after the extension before the quote ", which probably isn't actually an issue.

You might test at least the first suggestion in this unexplained situation, although even so Pierre was unable to reproduce the result you are obtaining.
tomv
Posts: 21
Joined: Sat Oct 30, 2021 4:33 pm

Re: file extension error?

Post by tomv »

Hi there and happy new year!

Unfortunately the two issues discussed in the previous message are not the cause.
I don't understand how Pierre can't reproduce the error. I attach a small video where you can see what happens. Look at the size of the images and that the .JPG_original file is also processed.
You do not have the required permissions to view the files attached to this post.