What are the differences between resizeImage
and scaleImage
?
I need to resize an image if its size is > $myLimit
Example (pseudocode):
$myLimit = 1MB
user uplaod an image of 1000x1000 of 2MB
2MB > $myLimit
while( $imagefilesize > $myLimit ) {
resizeImageBy 0.9%;
}
//> output 900x900 image of 900 kB
In the while
block, which of the two methods should I use?
Edit: I found something that could help: http://www.imagemagick.org/Usage/resize/ But could someone simplify that?
The difference between the two seems to be that scaleImage
does a raw, pixel based resize, while resizeImage
can use an interpolation filter:
imagick::INTERPOLATE_AVERAGE
imagick::INTERPOLATE_BICUBIC
imagick::INTERPOLATE_BILINEAR
...
that is likely to produce better results.
More on the various interpolation methods on Wikipedia.
Brilliant, their own documentation is awful... But ok: It looks to me like resizeImage is more powerful, and therefore the better choice... This link shows the usage along with some measurements for different filters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With