I'm creating a thumbnail using the folowing code:
Code: Select all
$r = NewMagickWand();
MagickReadImage($r, '15_light.gif');
MagickSetImageIndex($r, 0);
// MagickEnhanceImage($r, MW_LanczosFilter);
MagickSetImageType($r, MW_OptimizeType);
//MagickEnhanceImage($r);
$thumb_width = 135;
$thumb_height = 135;
list($width, $height) = getimagesize('15_light.gif');
if($thumb_width && ($width > $thumb_width))
{
$height = round($height * $thumb_width / $width);
$width = $thumb_width;
}
if($thumb_height && ($height > $thumb_height))
{
$width = round($width * $thumb_height / $height);
$height = $thumb_height;
}
//$r = MagickTransformImage($r, '0x0', '120x120' );
MagickResizeImage($r, $width, $height, MW_CubicFilter, 0.5);
MagickSetImagePage($r, 0, 0, 0, 0);
header('Content-Type: image/jpeg');
MagickEchoImageBlob($r);
Examples:
Original image:
Created thumbnail:
What should I do to create thumbnails of a good quality?
Thanks