JPEG metadata issue with -clean

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

Moderators: XnTriq, helmut, xnview

Post Reply
qweeeraz
Posts: 4
Joined: Thu Jul 02, 2020 4:05 am

JPEG metadata issue with -clean

Post by qweeeraz »

Hello. Please, help me.

I have png and jpeg files in directory.

then, i write command in CMD line.


d:\distr\NConvert-win64\NConvert\nconvert.exe -clean 95 -rotate_flag smooth -rotate 0.5 -ratio -rtype lanczos -rflag incr -rflag orient -resize 105%% 105%% -sharpen 1 -autocontrast -autolevels -noise reduce -canvas 99%%%% 99%%%% center -bgcolor 255 255 255 -overwrite -ignore_errors *

and what i recieve https://prnt.sc/ta6q29

PNG files is complete, but JPG files is NO complete.
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: JPG files is NO complete

Post by cday »

I am no expert on the command line but you could try replacing the last term:

Code: Select all

*
by

Code: Select all

*.*
Or alternatively by:

Code: Select all

*.png *.jpg

Also, although seemingly not actually an issue, in batch files the percent sign is doubled to escape the character:

So the -resize 105%% 105%% term is correct but --canvas 99%%%% 99%%%% should be -canvas 99%% 99%%.

Was your code exported from XnConvert (or XnView MP Batch convert)?
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: JPG files is NO complete

Post by cday »

I have noticed that you don't specify an output file type:

Code: Select all

-out format       : Output format name
While that isn't always necessary, I'm not sure of the result with your code when the input files are of multiple types.

You may also want to specify the output file names:

Code: Select all

-o filename       : Output filename
              Use # to specify position of numeric enumerator
              Use % to specify source filename
              Use $ to specify full source pathname
              Use $$ to specify source folder name
And also possibly the compression used, see the available options in the help file.

You may also need to use separate code lines for PNG and JPEG files, in order to output the two file types with different settings.
qweeeraz
Posts: 4
Joined: Thu Jul 02, 2020 4:05 am

Re: JPG files is NO complete

Post by qweeeraz »

cday, thank you!

replacing * by *.* and replacing * by *.* *.png *.jpg not help

replacing canvas 99%%%% 99%%%% by -canvas 99%% 99%% not help too

Then, i specify output format to jpeg:

d:\distr\NConvert-win64\NConvert\nconvert.exe -clean 95 -rotate_flag smooth -rotate 0.5 -ratio -rtype lanczos -rflag incr -rflag orient -resize 105%% 105%% -sharpen 1 -autocontrast -autolevels -noise reduce -canvas 99%%%% 99%%%% center -bgcolor 255 255 255 -overwrite -ignore_errors -out jpeg 085561-transparent-background-spiderman-clipart-png-download-yeugzu-medium.jpeg

and recieve message https://prnt.sc/tacgdr

then i specify output format to jpg:

d:\distr\NConvert-win64\NConvert\nconvert.exe -clean 95 -rotate_flag smooth -rotate 0.5 -ratio -rtype lanczos -rflag incr -rflag orient -resize 105%% 105%% -sharpen 1 -autocontrast -autolevels -noise reduce -canvas 99%%%% 99%%%% center -bgcolor 255 255 255 -overwrite -ignore_errors -out jpg 085561-transparent-background-spiderman-clipart-png-download-yeugzu-medium.jpeg

and recieve message https://prnt.sc/tach0h
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: JPG files is NO complete

Post by cday »

It is difficult to "see the wood for the trees" with your long code lines including long file names.

On your last point, when the output format is specified using -out then 'jpeg' is correct because that is the file format name, not an extension.

And the -canvas 99%%%% 99%%%% term should be -canvas 99%% 99%% even though it doesn't seem to matter in practice.

It would also be helpful if you could paste the terminal output into your post rather than attach a screenshot, that is possible but you may need to do an internet search to find out how, Windows is a pain.

Beyond that, I would suggest trying to isolate the immediate problem using simpler test code and short filenames, maybe just a simple rotation for example, and when that works to add further terms progressively.
qweeeraz
Posts: 4
Joined: Thu Jul 02, 2020 4:05 am

Re: JPG files is NO complete

Post by qweeeraz »

cday wrote: Thu Jul 02, 2020 10:23 am It is difficult to "see the wood for the trees" with your long code lines including long file names.

On your last point, when the output format is specified using -out then 'jpeg' is correct because that is the file format name, not an extension.

And the -canvas 99%%%% 99%%%% term should be -canvas 99%% 99%% even though it doesn't seem to matter in practice.

It would also be helpful if you could paste the terminal output into your post rather than attach a screenshot, that is possible but you may need to do an internet search to find out how, Windows is a pain.

Beyond that, I would suggest trying to isolate the immediate problem using simpler test code and short filenames, maybe just a simple rotation for example, and when that works to add further terms progressively.
Ok. I rename file to "test" and do simple filter. I copy output text from command line. Nothing happens to the file.

d:\edu\picpic\cd\picpng-com\pic-convert-example\pic-example>d:\distr\NConvert-win64\NConvert\nconvert.exe -clean 95 -out jpeg test.jpg
** NCONVERT v7.41 (c) 1991-2019 Pierre-E Gougelet (May 15 2020/15:47:49) **
Version for Windows Xp/Vista/7 x64 (All rights reserved)
** This is freeware software (for non-commercial use)
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: JPG files is NO complete

Post by cday »

qweeeraz wrote: Thu Jul 02, 2020 10:36 am Ok. I rename file to "test" and do simple filter. I copy output text from command line. Nothing happens to the file.

d:\edu\picpic\cd\picpng-com\pic-convert-example\pic-example>d:\distr\NConvert-win64\NConvert\nconvert.exe -clean 95 -out jpeg test.jpg
** NCONVERT v7.41 (c) 1991-2019 Pierre-E Gougelet (May 15 2020/15:47:49) **
Version for Windows Xp/Vista/7 x64 (All rights reserved)
** This is freeware software (for non-commercial use)
This is confusing:

Your path to nconvert.exe is very long and I'm not sure that it is valid, although it does seem to launch the program, so presumably it is.

Could you test this minimal code and see if the input JPEG with a .jpg extension is rotated 90 degrees, substituting your path to nconvert.exe:

nconvert.exe -rotate 90 test.jpg
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: JPG files is NO complete

Post by cday »

Did you export your basic code from XnConvert (or XnView MP Batch convert)?

Are you running your code in a batch file .bat or directly at the command line?

Please note that when I unexpectedly starting using NConvert I had almost no command line experience and encountered many problems; eventually I developed my own way of working using batch files, which were in any case what I wished to create for future use. If you wish to run your code directly at the command line I can only offer very limited support.
qweeeraz
Posts: 4
Joined: Thu Jul 02, 2020 4:05 am

Re: JPG files is NO complete

Post by qweeeraz »

It works! I delete filter " -clean 95". JPEG don't like this filter.

Thank you cday for supporting.
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: JPG files is NO complete

Post by cday »

qweeeraz wrote: Thu Jul 02, 2020 7:36 pm It works! I delete filter " -clean 95". JPEG don't like this filter.
The help file entry for -clean has these option:

Code: Select all

-clean value  : JPEG Clean Metadata (EXIF/IPTC/...)
              1      : Comment
              2      : EXIF
              4      : XMP
              8      : EXIF thumbnail
              16     : IPTC
              32     : ICC Profile
              64     : Other markers
I understand the above to mean that one (or if desired probably multiple) of those specific numeric values should be entered to remove specific metadata parameters, for example:

Code: Select all

-clean 16
To remove all IPTC metadata.

Note that I haven't tested operation myself.
Post Reply