improve my thumbnail generator?
i have a this function which resizes images but the final quality looks blurred too much and not clear:
Any other class or a solution to imp开发者_运维问答rove the quality of thumbnails ?
Thanks
Other Note - i already changed the quality to 100 but nothing happened!
First of all, welcome to StackOverflow.
Unless you provide some tests / screenshots we can't do much to help you, you seem to be using the right combination of functions (imagecreatetruecolor
/ imagecopyresampled
) so my first guess would go to the $quality
argument in imagejpeg
and imagepng
functions.
For imagejpeg
I suggest you use $quality = 90
. For imagepng
should be $quality = 9
.
You can also try sharpening the image by using a convulsion like this one right before saving the image:
ImageConvolution($dst_image, array(array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1)), 8, 0);
For 3rdparty libraries I hear WideImage and Asido are quite good.
If you have access to imagemagick, which is usually pretty prevalent on web-servers, you can save yourself a lot of headaches by using the buit-in convert
command:
$cmd = escapeshellcmd("env convert -thumbnail $format " .
$_FILES['field_name']['tmp_name']; . " -interlace Line -enhance ". $tmp_name);
精彩评论