|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-03-12 08:23 UTC] 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 />'; PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
$algs = [ IMG_BELL, IMG_BESSEL, IMG_BICUBIC, IMG_BICUBIC_FIXED, IMG_BILINEAR_FIXED, IMG_BLACKMAN, IMG_BOX, IMG_BSPLINE, IMG_CATMULLROM, IMG_GAUSSIAN, IMG_GENERALIZED_CUBIC, IMG_HERMITE, IMG_HAMMING, IMG_HANNING, IMG_MITCHELL, IMG_POWER, IMG_QUADRATIC, IMG_SINC, IMG_NEAREST_NEIGHBOUR, IMG_WEIGHTED4, IMG_TRIANGLE, ]; foreach ($algs as $key => $alg) { $img = imagescale($oryginal, 600, 400, $alg); imagejpeg($img, 'tmp'.$key.'.jpg', 90); echo '<img src="tmp'.$key.'.jpg" /><br />'; } All images are the same...Can you try with imagesetinterpolation($oryginal, $alg); $img = imagescale($oryginal, 600, 400); $alg option of imagescale is ignored (yes, this is a "goto fail;" bug) It seems IMG_BILINEAR_FIXED produce this bad quality image. IMG_BICUBIC_FIXED and IMG_NEAREST_NEIGHBOUR seems to work better.