Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Imagick::resizeImage generates black image

When I tried to resize an image using imagemagick it generates a full black image. Below is my PHP code

$image = new \Imagick( 'test.jpg' );                
$image->resizeImage( 90, 90, Imagick::FILTER_LANCZOS, 0, TRUE );
$image->writeImage( 'test_thumbnail.jpg' );

I have given full permission to test.jpg

I use imagick module version: 3.1.2 and imageMagick version: 6.7.7-10

Any suggestions?

Thanks

like image 857
Balaji Avatar asked Nov 21 '15 20:11

Balaji


1 Answers

The problem is the blur value. 0 will result in a black image. The blur factor where > 1 is blurry, < 1 is sharp.

Try this:

$image = new \Imagick( 'test.jpg' );                
$image->resizeImage( 90, 90, Imagick::FILTER_LANCZOS, 0.9, TRUE );
$image->writeImage( 'test_thumbnail.jpg' );
like image 51
Tristan Avatar answered Nov 19 '22 02:11

Tristan