php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73272 imagescale() is not affected by, but affects imagesetinterpolation()
Submitted: 2016-10-09 12:12 UTC Modified: 2016-10-09 12:36 UTC
From: cmb@php.net Assigned: cmb
Status: Closed Package: GD related
PHP Version: master-Git-2016-10-09 (Git) OS: *
Private report: No CVE-ID:
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cmb@php.net
New email:
PHP Version: OS:

 

 [2016-10-09 12:12 UTC] cmb@php.net
Description:
------------
I've noticed that imagescale() permanently changes the interpolation
method, and does not use the interpolation method specified with
imagesetinterpolation(). The latter might be a documentation
issue; the imagesetinterpolation() manual page states:

| Changing the interpolation method affects the following
| functions when rendering:
| imagescale()

The former is a real bug, in my opinion, which appears to have
been introduced by fixing bug #66893.


Test script:
---------------
<?php

$src = imagecreatetruecolor(100, 100);
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
imageellipse($src, 49,49, 40,40, 0x000000);

imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);

$dst = array();
$dst[] = imagerotate($src, 60, 0xFFFFFF);
$dst[] = imagescale($src, 200, 200, IMG_NEAREST_NEIGHBOUR);
$dst[] = imagescale($src, 200, 200);
$dst[] = imagerotate($src, 60, 0xFFFFFF);

foreach ($dst as $i => $im) {
    imagepng($im, __DIR__ . DIRECTORY_SEPARATOR . "image-$i.png");
}


Expected result:
----------------
image-0.png and image-3.png as well as image-1.png and image-2.png
should be identical, respectively.


Actual result:
--------------
All images are different.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-09 12:24 UTC] cmb@php.net
-Summary: imagescale() permanently changes interpolation method +Summary: imagescale() is not affected by, but affects imagesetinterpolation() -Assigned To: +Assigned To: cmb
 [2016-10-09 12:30 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=340408
Log: Fix #73272: imagescale() is not affected by, but affects imagesetinterpolation()

We fix the documentation part of this bug, namely that imagesetinterpolation()
would affect imagescale() what has never been the case.
 [2016-10-09 12:36 UTC] cmb@php.net
> We fix the documentation part of this bug, namely that
> imagesetinterpolation() would affect imagescale() what has never
> been the case.

Well, actually it has been the case before PHP 5.5.11 due to bug
#66893.
 [2016-10-09 13:32 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b92216b97dcdae738ae24d9bdd1168565dc04406
Log: Fix #73272: imagescale() affects imagesetinterpolation()
 [2016-10-09 13:32 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2016-10-17 10:07 UTC] bwoebi@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b92216b97dcdae738ae24d9bdd1168565dc04406
Log: Fix #73272: imagescale() affects imagesetinterpolation()
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Wed Aug 16 13:01:57 2017 UTC