jpeg:extent bug?

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
degats

jpeg:extent bug?

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: jpeg:extent bug?

Post 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.
degats

Re: jpeg:extent bug?

Post 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)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: jpeg:extent bug?

Post 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.
degats

Re: jpeg:extent bug?

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: jpeg:extent bug?

Post 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.
degats

Re: jpeg:extent bug?

Post by degats »

Thanks, I'll give it a try when the windows build is up :)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: jpeg:extent bug?

Post by magick »

We'll update 6.5.9-5 Q16 for Windows tomorrow. We'll update the other Windows distributions next week.
degats

Re: jpeg:extent bug?

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: jpeg:extent bug?

Post by magick »

We need to issue new Windows executables with the jpeg:extent patch. We'll get to that in a day or two.
Post Reply