Req #66887 [Com]: imagescale - poor quality of scaled image
| From: | mruz at poczta dot onet dot pl | Date: | Wed, 12 Mar 2014 10:02:37 +0000 |
| Subject: | Req #66887 [Com]: imagescale - poor quality of scaled image | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-184740@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66887&edit=1
ID: 66887
Comment by: mruz at poczta dot onet dot pl
Reported by: mruz at poczta dot onet dot pl
Summary: imagescale - poor quality of scaled image
Status: Feedback
Type: Feature/Change Request
Package: GD related
Operating System: openSUSE 13.1
PHP Version: 5.5.10
Block user comment: N
Private report: N
New Comment:
I resized to 600x400:
http://mruz.pl/test/test1.jpg (imagecopyresized)
http://mruz.pl/test/test2.jpg (imagescale)
http://mruz.pl/test/test.jpg (oryginal)
If I apply white background after imagescale():
imagecolorallocatealpha($background, r, g, b, $opacity);
imagealphablending($background, true);
imagecopy($background, $img, 0, 0, 0, 0, $width, $height)
is much worse..
http://mruz.pl/test/test3.jpg (background after
imagescale)
Previous Comments:
------------------------------------------------------------------------
[2014-03-12 09:20:03] pajoye@php.net
imagescale has many different algorithms, some are good for downscaling other for upscaling.
Performance differs too from one to another.
Try other algorithms and use the right one depending on what you want to do. Also having an example
image may help to answer. Can you post a link to one?
------------------------------------------------------------------------
[2014-03-12 08:28:09] mruz at poczta dot onet dot pl
Or even http://www.php.net/function.imagecopyresized
------------------------------------------------------------------------
[2014-03-12 08:23:10] mruz at poczta dot onet dot pl
Description:
------------
Is it intended behavior that the quality of http://www.php.net/function.imagescale is much
worse than http://www.php.net/function.imagecopyresampled
?
I'm using PHP 5.5.9, but see in the PHP 5.5.10 changelog nothing on this issuse was changed.
Test script:
---------------
$oryginal = imagecreatefromjpeg('test.jpg');
$img = imagecreatetruecolor(300, 200);
imagecopyresized($img, $oryginal, 0, 0, 0, 0, 300, 200, 600, 400);
imagejpeg($img, 'test1.jpg', 90);
echo '<img src="test1.jpg" /><br />';
$img = imagescale($oryginal, 300, 200);
imagejpeg($img, 'test2.jpg', 90);
echo '<img src="test2.jpg" /><br />';
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66887&edit=1