Req #66887 [Fbk]: imagescale - poor quality of scaled image

From: Date: Wed, 12 Mar 2014 10:55:56 +0000
Subject: Req #66887 [Fbk]: imagescale - poor quality of scaled image
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184743@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
 Updated by:         pajoye@php.net
 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:

and which result do you get? link pls


Previous Comments:
------------------------------------------------------------------------
[2014-03-12 10:37:20] mruz at poczta dot onet dot pl

$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...

------------------------------------------------------------------------
[2014-03-12 10:20:24] pajoye@php.net

Please ignore the background call. It is totally unrelated to this problem. JPEG does not have
alpha, so could you please using only the scale function and compare the results?

See http://www.php.net/imagesetinterpolation
for the different algorithms available.

------------------------------------------------------------------------
[2014-03-12 10:02:36] mruz at poczta dot onet dot pl

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)

------------------------------------------------------------------------
[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

------------------------------------------------------------------------


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

    https://bugs.php.net/bug.php?id=66887


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=66887&edit=1


Thread (15 messages)

« previous php.bugs (#184743) next »