Feature suggestion: max. "-define jpeg:extent" (patch doesn't work)

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
Marsu42
Posts: 75
Joined: 2014-06-12T03:17:45-07:00
Authentication code: 6789
Location: Berlin

Feature suggestion: max. "-define jpeg:extent" (patch doesn't work)

Post by Marsu42 »

I don't know if you feel this is over the top, but for what it's worth I'd like to do IM internally what I'm currently doing scripted with multiple runs: When defining "-define jpeg:extent" imho what is of interest very often is not to go higher than a certain *maximal* size, not to have a *fixed* size.

Current behavior: With a batch of sample images and a certain quality, I end up between 700k and 2400k. In this example I'm setting "-define jpeg:extent=1500k". However, this results in a way too low compression for the images with good compressibility, essentially wasting space and bandwidth.

Suggested behavior: Define both "-define jpeg:extent=1500k" and "-quality xyz" in conjunction and let IM choose whatever comes out smallest.
Last edited by Marsu42 on 2015-03-06T09:43:19-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Feature suggestion: max. "-define jpeg:extent"

Post by magick »

Download / install ImageMagick 6.9.0-8 Beta tomorrow. It has a patch to improve the results of the jpeg:extent define.
User avatar
Marsu42
Posts: 75
Joined: 2014-06-12T03:17:45-07:00
Authentication code: 6789
Location: Berlin

Re: Feature suggestion: max. "-define jpeg:extent"

Post by Marsu42 »

magick wrote:Download / install ImageMagick 6.9.0-8 Beta tomorrow. It has a patch to improve the results of the jpeg:extent define.
That's great news, IM gets my award for the most responsive oss team :-)

I'll have to wait until there are windows binaries to test the change, I'm done trying to compile IM myself with cygwin/mingw x64 as all these additional required libs for a full build are too much of a hassle for a casual compile.
User avatar
Marsu42
Posts: 75
Joined: 2014-06-12T03:17:45-07:00
Authentication code: 6789
Location: Berlin

Re: Feature suggestion: max. "-define jpeg:extent" (patch doesn't work)

Post by Marsu42 »

magick wrote:Download / install ImageMagick 6.9.0-8 Beta tomorrow. It has a patch to improve the results of the jpeg:extent define.
I now had the opportunity to test the new windows binary " ImageMagick 6.9.0-9 Q16 x64 2015-02-28", and unfortunately it doesn't work as intended. For example with two test files with same dimensions, but very different compressibility (bad.tif & good.tif) I've tried to run these commands:

a) "convert -quality 75" results in good.jpg=1mb, bad.jpg=6mb
b) "convert -quality 75 -define jpeg:extent=5000kb" results in *both* files being about 5mb

What I had in mind is that in case b) good.jpg should stay at 1mb, but "bad.jpg" should be clipped at 5mb (instead of 6) so that the combination of -quality and jpeg:extent behave like a "upper ceiling" option.

Am I doing something wrong, what does the patch you announced above actually do? Thanks for any insight!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Feature suggestion: max. "-define jpeg:extent" (patch doesn't work)

Post by magick »

We'll have a patch in ImageMagick 6.9.0-10 Beta by sometime tomorrow to address your suggestion.
User avatar
Marsu42
Posts: 75
Joined: 2014-06-12T03:17:45-07:00
Authentication code: 6789
Location: Berlin

Re: Feature suggestion: max. "-define jpeg:extent" (patch doesn't work)

Post by Marsu42 »

magick wrote:We'll have a patch in ImageMagick 6.9.0-10 Beta by sometime tomorrow to address your suggestion.
Thanks, it's working now :-)
Post Reply