Page 1 of 1

Save JPEG in fixed file size

Posted: Fri Jul 25, 2008 1:57 pm
by dominique
Hi xnview !
Do you have an option to adapt the JPEG quality automaticaly to obtain a required file size?
Or maybe do you know an algorithm able to do this with GFL functions?
Rgds

Re: Save JPEG fixin file size

Posted: Fri Jul 25, 2008 1:58 pm
by xnview
dominique wrote: Or maybe do you know an algorithm able to do this with GFL functions?
No, perhaps by adjusting quality and compress in memory

Posted: Fri Jul 25, 2008 2:04 pm
by dominique
Ok I have this idea too... maybe I can do a dichotomy search with given bounds.
I'll give you some news when I have results.

Save JPEG: how to see old/new file size, old/new visual qual

Posted: Thu Apr 08, 2010 4:39 pm
by vedavrata
When i save a JPEG file, i just can specify a "Quality" (%) but i can not see the old and the new file size, as well can not see the image difference (what i would lose), can't i ?..

How to see the both old (original) / new (will be saved) file size of JPEG file?
How to see the both old (original) image / new (will be saved) image simulaneously [in two modes "Fit to half a widnow / fit to half a widnow" and "No fit / no fit (i.e. 1:1 / 1:1)"] to evaluate visual quality ?

FYI: I use Linux (X11) version of XnView unber Ubuntu Linux.

Re: Save JPEG in fixed file size

Posted: Thu Apr 08, 2010 4:46 pm
by dominique
You should post this the XnView section of the forum :D
Here is the GFLSDK forum.

Re: Save JPEG in fixed file size

Posted: Thu Apr 08, 2010 5:05 pm
by vedavrata
dominique wrote:You should post this the XnView section of the forum :D
Here is the GFLSDK forum.
Excuse me.

Re: Save JPEG in fixed file size

Posted: Tue Apr 20, 2010 3:00 pm
by iycgtptyarvg
What I do is the following:

Set the initial quality to 90% and picture size to 100%

while(pic_size > wanted_size)
quality -= 5%
picture size -= 10%

So, the iterations go like this (quality, pic size):
1. 90%, 100%
2. 85%, 90%
3. 80%, 80%
4. 75%, 70%
5. 70%, 60%
...


Of course, if you only want to change the quality settings you can simply use the halving method which has complexity O(log n).

Example:
Org size 10MB, wanted size = 500KB
1. Q100% = 7MB (initial boundary)
2. Q10% = 20KB (initial boundary)
3. Q55% = 300KB (100+10 / 2)
4. Q78% = 650KB (100+55 / 2)
5. Q67% = 520KB (55+78 / 2)
6. Q61% = 460KB (55+67 / 2)
7. Q64% = 495KB (61+67 / 2)
8. Q65% = 510KB (64+67 / 2)

Result : Q = 64