Setting quality with imagemagick?

I use the following code to create a thumbnail on the site:

$small_image = new Imagick($large_path."/".$pic['image']); $small_image->thumbnailImage(100, 0); $small_image->writeImage($small_path."/".$pic['image']); 

He sets his own quality, and I tried to add

 $small_image->setCompression(imagick::COMPRESSION_JPEG); $small_image->setCompressionQuality(1); 

But that didn’t change anything. I also tried

 $img = new Imagick($small_path."/".$pic['image']); $img->setCompression(Imagick::COMPRESSION_JPEG); echo $img->setCompressionQuality(1); // should come out ugly $img->writeImage(); 

But even that didn't resize with quality 1. Any ideas what I'm doing wrong?

+4
source share
1 answer

I think you want:

 $small_image->setImageCompression(imagick::COMPRESSION_JPEG); $small_image->setImageCompressionQuality(1); 

Note the "Image" between "get" / "set" and "Compression".

+8
source

All Articles