Bug #70441 [NEW]: interpolation modes broken in imagescale
| From: | programmer at bardware dot de | Date: | Sun, 06 Sep 2015 18:35:19 +0000 |
| Subject: | Bug #70441 [NEW]: interpolation modes broken in imagescale | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195816@lists.php.net to get a copy of this message | ||
From: programmer at bardware dot de
Operating system: Windows 7
PHP version: 7.0.0RC2
Package: GD related
Bug Type: Bug
Bug description:interpolation modes broken in imagescale
Description:
------------
I use the thread safe Version php-7.0.0RC2-Win32-VC14-x86.zip as
provided on http://windows.php.net/qa/
I have a script to resize images. I use it with PHP 5.6 and everything's
fine. The images are broken (look bad) when the same script is used in
PHP 7.
I found out that when I use another $mode in the call to imagescale(...)
the images are correct.
I looped over all modes and it seems BICUBIX_FIXED, BILINEAR_FIXED and
NEAREST_NEIGHBOUR are the only ones producing good images.
I had been using CATMULLROM before.
Test script:
---------------
<?php
$arrInterpolMethod= [
"IMG_BELL" => IMG_BELL
, "IMG_BESSEL" => IMG_BESSEL
, "IMG_BICUBIC" => IMG_BICUBIC
, "IMG_BICUBIC_FIXED" => IMG_BICUBIC_FIXED
, "IMG_BILINEAR_FIXED" => IMG_BILINEAR_FIXED
, "IMG_BLACKMAN" => IMG_BLACKMAN
, "IMG_BOX" => IMG_BOX
, "IMG_BSPLINE" => IMG_BSPLINE
, "IMG_CATMULLROM" => IMG_CATMULLROM
, "IMG_GAUSSIAN" => IMG_GAUSSIAN
, "IMG_GENERALIZED_CUBIC" => IMG_GENERALIZED_CUBIC
, "IMG_HERMITE" => IMG_HERMITE
, "IMG_HAMMING" => IMG_HAMMING
, "IMG_HANNING" => IMG_HANNING
, "IMG_MITCHELL" => IMG_MITCHELL
, "IMG_POWER" => IMG_POWER
, "IMG_QUADRATIC" => IMG_QUADRATIC
, "IMG_SINC" => IMG_SINC
, "IMG_NEAREST_NEIGHBOUR" => IMG_NEAREST_NEIGHBOUR
, "IMG_WEIGHTED4" => IMG_WEIGHTED4
, "IMG_TRIANGLE" => IMG_TRIANGLE
];
if( $im = imagecreatefromjpeg( 'D:/Daten/Lumia_820/WP_20150829_028.jpg'
) ) {
$MaxWert = 2048;
$Width = ImagesX($im);
$Height = ImagesY($im);
if($Width>$Height) {
$NeuWidth = $MaxWert;
$NeuHeight = round( ( $Height * ($NeuWidth / $Width) ) / 4 ) * 4;
} else {
$NeuHeight = $MaxWert;
$NeuWidth = round( ( $Width * ($NeuHeight / $Height) ) / 4 ) * 4;
}
foreach( $arrInterpolMethod as $interpolName => $interpolConstant ) {
$NeuImg = imagescale( $im, $NeuWidth, $NeuHeight, $interpolConstant
);
ImageInterlace( $NeuImg, 1 );
ImageJPEG($NeuImg,
'D:/Daten/php/WP_20150829_028_'.$interpolName.'.jpg', 80);
ImageDestroy($NeuImg);
}
ImageDestroy($im);
}
Expected result:
----------------
I expect to get 20 not broken looking images
--
Edit bug report at https://bugs.php.net/bug.php?id=70441&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70441&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70441&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70441&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70441&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70441&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70441&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70441&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70441&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70441&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70441&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70441&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70441&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70441&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70441&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70441&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70441&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70441&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70441&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70441&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70441&r=mysqlcfg