Weak quality functions to resize pictures?
| From: | Tomasz Rusc | Date: | Mon, 24 Sep 2001 22:23:10 +0000 |
| Subject: | Weak quality functions to resize pictures? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-68602@lists.php.net to get a copy of this message | ||
I installed PHP 4.0.6 to test the functions imagecopyresized () and
imagecopyresampled().
In documentation was information about implicit use of the bicubic
interpolation algorithm within the function imagecopyresized ().
I compared the result of the function with Adobe PhotoShop bicubic
resized picture.
The results from PHP function was very bad. It seemed to be like normal
ordinary imagecopyresized (pixel replication algorithm). There is no
smoothing recognizable.
Which algorithm is used within the named functions?
Here is my code :
<?
$im_in=ImageCreateFromJPEG("17960.jpg");
$size2=GetImageSize("17960.jpg");
$im_out_3=ImageCreate($size2[0]*3,$size2[1]*3);
$im_out_4=ImageCreate($size2[0]*3,$size2[1]*3);
ImageCopyResized($im_out_3,$im_in2,0,0,0,0,$size2[0]*3,$size2[1]*3,$size2[0],$size2[1]);
ImageCopyResampled($im_out_4,$im_in2,0,0,0,0,$size2[0]*3,$size2[1]*3,$size2[0],$size2[1]);
ImageJPEG($im_out_3,"larg3.jpg",100);
ImageJPEG($im_out_4,"larg4.jpg",100);
ImageDestroy($im_out_3);
ImageDestroy($im_out_4);
ImageDestroy($im_in2);
$x2=$size2[0]*3;
$y2=$size2[1]*3;
?>
<img SRC="17960.jpg" border="0"> //1) oryginal picture
<img SRC="17960.jpg" border="0" WITDH=<?echo $x2;?> HEIGHT=<?echo
$y2;?>>
//2) normal the ordinary imagecopyresized
<img SRC="larg3.jpg" border="0"> //3) the result from the function
ImageCopyResized()
<img SRC="larg4.jpg" border="0">//4) the result from the function
ImageCopyResampled()
Results from point 3) , 4) 5) are exactly the same. I didnt find
differences.
In the Adobe application result was much better
Anyone can say what is reason or anybody tested quality od this
pictures.
Best regards Tom
--
---------------------------------------------------------------------------
Tomasz Rusc
Mobile Phone: +49 175 550 175 9
E-mail: rusc@uni-wuppertal.de
---------------------------------------------------------------------------
"The trouble with our times is that the future is not what it used to
be"
(Paul Valery)