For example, with an image 1024x1024px:
Code: Select all
convert image.png -define jpeg:extent=400kB image.jpg
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.