Using -define jpeg:size= with PHP
Posted: 2012-03-21T10:53:24-07:00
I have read that when shrinking an image using -define jpeg:size= can greatly increase the speed of the operation. Is there a way to do this with the PHP module? My current code is:
I tried changing the start to the following but it made no difference:
Code: Select all
$image = new Imagick('origional.jpg');
$image->stripImage();
$image->setImageCompression(imagick::COMPRESSION_JPEG);
if($image->getImageHeight() <= $image->getImageWidth()) {
$image->resizeImage(800,0, imagick::FILTER_POINT, 1);
} else {
$image->resizeImage(0,800, imagick::FILTER_POINT, 1);
}
$image->setImageCompressionQuality(70);
$image->writeImage('large.jpg');
if($image->getImageHeight() <= $image->getImageWidth()) {
$image->resizeImage(190,0, imagick::FILTER_POINT, 1);
} else {
$image->resizeImage(0,190, imagick::FILTER_POINT, 1);
}
$image->setImageCompressionQuality(70);
$image->writeImage('thumb.jpg');
$image->destroy();
Code: Select all
$image = new Imagick();
$image->setSize(800, 532);
$image->readImage('origional.jpg');