#23491 [Fbk->Opn]: Very bad Quality when I use imagecopyresized

From: Date: Tue, 06 May 2003 05:49:25 +0000
Subject: #23491 [Fbk->Opn]: Very bad Quality when I use imagecopyresized
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39130@lists.php.net to get a copy of this message
ID: 23491 User updated by: ab at berg dot net Reported By: ab at berg dot net -Status: Feedback +Status: Open Bug Type: GD related Operating System: RedHat Linux 7.0 with gd-1.8.4-9 PHP Version: 4.3.2RC2 New Comment: Hi Sniper, i use the function: function imgthumb($ori,$thump,$thumbQuality,$thumbWidth) { $origImageHandle = ImageCreateFromJPEG($ori); $imageWidth = imagesx($origImageHandle); $imageHeigth = imagesy($origImageHandle); $thumbHeigth = floor($thumbWidth * $imageHeigth / $imageWidth); $thumbImageHandle = ImageCreate("$thumbWidth","$thumbHeigth"); imagecopyresized($thumbImageHandle,$origImageHandle,0,0,0,0,$thumbWidth, $thumbHeigth,imagesx($origImageHandle),imagesy($origImageHandle)); imagejpeg($thumbImageHandle,$thump,"$thumbQuality"); } And this are the example Images: Original Image: http://www.andreas.boehm.de/1/ori.JPG Image with 4.2.3: http://www.andreas.boehm.de/1/good.jpg Image with 4.3.x: http://www.andreas.boehm.de/1/bad.jpg Andreas Previous Comments: ------------------------------------------------------------------------ [2003-05-05 16:39:07] sniper@php.net Please provide a complete example script which actually produces the result you show here. ------------------------------------------------------------------------ [2003-05-05 09:36:36] ab at berg dot net Hi Rasmus, really? Why works the thumbnail function with php 4.2.3 and gd 1.8.x perfectly with more than 256 colours and with php 4.3.x not? How can I compile the GD2 bundled? What must I change in my configure command? Thanks a lot Andreas ------------------------------------------------------------------------ [2003-05-05 09:26:57] rasmus@php.net Actually, never mind, just took a look at your images. I assume you were also using gd-1.8 with PHP 4.2.3? ------------------------------------------------------------------------ [2003-05-05 09:22:50] rasmus@php.net gd-1.x only supports 256 colours. You should be using the bundled version of gd2 and then ImageCreateTrueColor() instead of ImageCreate() in your code. Then the thumbnail would look nice. ------------------------------------------------------------------------ [2003-05-05 08:51:07] ab at berg dot net Hi Derick, here my thumbnail-function: function imgthumb($ori,$thump,$thumbQuality,$thumbWidth) { $origImageHandle = ImageCreateFromJPEG($ori); $imageWidth = imagesx($origImageHandle); $imageHeigth = imagesy($origImageHandle); $thumbHeigth = floor($thumbWidth * $imageHeigth / $imageWidth); $thumbImageHandle = ImageCreate("$thumbWidth","$thumbHeigth"); imagecopyresized($thumbImageHandle,$origImageHandle,0,0,0,0,$thumbWidth,$thumbHeigth,imagesx($origImageHandle),imagesy($origImageHandle)); imagejpeg($thumbImageHandle,$thump,"$thumbQuality"); } Thx for your fast answer Andreas ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/23491 -- Edit this bug report at http://bugs.php.net/?id=23491&edit=1

« previous php.bugs (#39130) next »