Resize image to specific size
I know there are several ways to resize an image via the command line. Some of them are specified here. However, I was wondering whether there is a way to specify the size of the resized image, e.g. I want to resize an image that is 8.5 MB big to an image that is 2.5 MB. Preferably, the solution uses imagemagick.
Solution 1:
With credit to here, there is a jpeg codec option for Imagemagick's convert
supports an option for jpeg that allows to restrict the size of the output file: -define jpeg:extent=max_value
. It is used as:
convert test.jpg -define jpeg:extent=1M testout.jpg
If anyone could tell where such settings are officially documented, I will include it in this answer.