JPEG compression

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

Moderators: XnTriq, helmut, xnview

marten
Posts: 8
Joined: Fri Nov 19, 2021 11:10 am

JPEG compression

Post by marten »

Hello

I want very simply compress JPG images.
I use this command :
nconvert -overwrite -c 5 -greater_than filesize 1000000 C:\Users\Marten\Desktop\TESTFOTO\%\*.jPG
But .. no compression also no compression with
nconvert -overwrite -c 8 -greater_than filesize 1000000 C:\Users\Marten\Desktop\TESTFOTO\%\*.jPG
what am i doing wrong ?
thx for help
cday
XnThusiast
Posts: 4165
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: COMPRESS

Post by cday »

For JPEG output the compression level is set by the following term:

Code: Select all

-q value          : JPEG/FPX/WIC/PDF/JPEG2K/WebP quality (default : 85)
For example:

Code: Select all

-q 75
You may also need the following term:

Code: Select all

-out jpeg
So to be sure:

Code: Select all

-out jpeg -q 75
cday
XnThusiast
Posts: 4165
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: JPEG compression

Post by cday »

I'm sorry, I missed the fact that you are using the -greater_than filesize option which is fairly new.

I think the problem may be that the reference filesize is possibly to be expressed in KiB rather than bytes, you can at least try that.
marten
Posts: 8
Joined: Fri Nov 19, 2021 11:10 am

Re: JPEG compression

Post by marten »

thanks anyway.
i give this a try
marten
Posts: 8
Joined: Fri Nov 19, 2021 11:10 am

Re: JPEG compression

Post by marten »

cday thank you man.
it works perfect
i use now
nconvert -overwrite -q 10 -greater_than filesize 800000 C:\Users\Marten\Desktop\TESTFOTO\%\*.jPG
and automate this every hour
perfect.
cday
XnThusiast
Posts: 4165
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: JPEG compression

Post by cday »

I assume that when the -greater_than filesize option is used the filesize parameter is expressed in bytes, I recall when the issue came up before asking that the units be included in the help file, but couldn't recall the units actually used.
JiyaHana
Posts: 7
Joined: Thu Dec 21, 2023 6:25 am

Re: JPEG compression

Post by JiyaHana »

I changed my command to:

Code: Select all

nconvert -overwrite -q 10 -greater_than filesize 800000 C:\Users\Marten\Desktop\TESTFOTO\%\*.jPG
and it worked perfectly.

Now, I’m automating this every hour to keep my images compressed. Before I was using an online jpeg compressor tool. It worked well.