I'm using Imagick and like to scale an image to a maximum file size of 2.5MB
I had a look to this SOF question: ImageMagick: scale JPEG image with a maximum file-size which is exactly what I want to do but the extent()
method from Imagick does not have the size parameter: http://www.php.net/manual/en/imagick.extentimage.php
Anyone knows how I could to it? At the moment I'm trying to calculate a coefficient between the original file size and the target file size to calculate a new resolution but found out that the resolution is not proportional to the file size.
Update - The output format is always JPEG so if there is a way to calculate the size before to save it that would be great
Thanks in advance, Maxime