Page 1 of 1

jpeg:extent bug?

Posted: 2010-02-11T11:34:17-07:00
by degats
I've found some strange behaviour when trying to use jpeg:extent in the windows (6.5.9-3) build of IM

For example, with an image 1024x1024px:

Code: Select all

convert image.png -define jpeg:extent=400kB image.jpg
This often results in an image file with the equivalent file size greater than 400kB. (421k in this case - the same size as -quality 100% in fact. Some other images resulted in even bigger file sizes)

For the 2048x2048px source of the above image (also .png - resized for the above), jpeg:extent=400kB results in a file of 398kB, which is what I would expect.

Various IM quality settings:
100 ~= 421k
99 ~= 332k
90 ~= 140k
80 ~= 70k
for 2048x2048:
100 ~= 1.18MB
94 ~= 433k
93 ~= 398k


For a different image (also 1024x1024):
-quality 100% = 464k
99% = 372k
98% and jpeg:extent=400kB gives 298k

For this one, the result is below the threshold, but is also not the best quality for it.


I couldn't find the relevant code in the source, so I haven't got any specific ideas about what's causing it.

Re: jpeg:extent bug?

Posted: 2010-02-11T13:46:45-07:00
by magick
We can reproduce the problem you posted and have a patch. Look for it in ImageMagick 6.5.9-4 Beta available sometime tomorrow. Thanks.

Re: jpeg:extent bug?

Posted: 2010-02-13T10:45:46-07:00
by degats
Wow, that was quick :)

Doesn't seem to have fully fixed the problem though... (tested with ftp://ftp.imagemagick.org/pub/ImageMagi ... ws-dll.exe )

The second image (1024) no-longer chooses a quality setting too low, but now chooses 100% as with the other one, both resulting in a file larger than the jpeg:extent threshold.

However, the first image @ 2048 now chooses 1 quality setting too low, now resulting in 371k instead of the correct 398k it did previously.
The second image @ 2048 also results in a file larger than the 400k threshold (1 setting too high)

Re: jpeg:extent bug?

Posted: 2010-02-13T11:14:09-07:00
by magick
Post a URL to your image(s) and the commands you are using. We need to reproduce the problem before we can comment.

Re: jpeg:extent bug?

Posted: 2010-02-13T12:24:58-07:00
by degats
http://www.mediafire.com/?tttzmwgiyhn

Slightly confusingly named, b2048.png is the 'first' image I'm talking about above, a is the second.
Included is a batch file with the commands used with jpeg:extent and also to generate a load of quality settings.

You'll have to change the path of convert if you want to run the bat file.

Re: jpeg:extent bug?

Posted: 2010-02-13T12:30:17-07:00
by magick
We can reproduce the problem you posted and have a patch. Look for it in ImageMagick 6.5.9-5 Beta available sometime tomorrow. Thanks.

Re: jpeg:extent bug?

Posted: 2010-02-13T12:47:23-07:00
by degats
Thanks, I'll give it a try when the windows build is up :)

Re: jpeg:extent bug?

Posted: 2010-02-13T13:13:10-07:00
by magick
We'll update 6.5.9-5 Q16 for Windows tomorrow. We'll update the other Windows distributions next week.

Re: jpeg:extent bug?

Posted: 2010-02-17T21:10:30-07:00
by degats
Tested with ftp://ftp.imagemagick.org/pub/ImageMagi ... ws-dll.exe and the same test case, I'm still getting the same results.

a1024, a2048 and b1024 all result in a file larger than the 400kB threshold. (410-464k)
b2048 results in a file 1 setting lower than it ideally should - ~370k when a ~398k is available.

Re: jpeg:extent bug?

Posted: 2010-02-18T07:05:00-07:00
by magick
We need to issue new Windows executables with the jpeg:extent patch. We'll get to that in a day or two.