|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-02-14 19:22 UTC] drew dot mclellan at gmail dot com
Description:
------------
The behaviour of imageconvolution() appears to have changed in PHP 5.5.9. The results are visual, so hard to describe, but the behaviour is significantly different from earlier versions.
The test script is boilerplate code for basic image sharpening, as found all over the web. In PHP 5.5.9 the result is a loss of brightness in the resulting image.
Test script:
---------------
$image = imagecreatefromjpeg('/path/to/picture.jpg');
$matrix = array(array(-1, -1, -1), array(-1, 20, -1), array(-1, -1, -1));
$divisor = array_sum(array_map('array_sum', $matrix));
imageconvolution($image, $matrix, $divisor, 0);
echo imagecolorat($image, 0, 0);
Expected result:
----------------
The echo'd output (colour reference number at 0,0) should be the same in PHP 5.5.8 and 5.5.9 for the same input image.
Actual result:
--------------
The output number is much lower in 5.5.9 than 5.5.8, indicating a darker colour and a loss of brightness. The issue is that the behaviour has changed.
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
Here's an image to show the visual differences between 5.5.8 and 5.5.9. As Drew notes, it's significant. These tests were run on OS X, but the issue is also present on Linux (and I assume Windows, but do not have a way to test that to confirm). In the test, the following matrix was applied: $matrix = array(array(-1, -1, -1), array(-1, 20, -1), array(-1, -1, -1)); $divisor = array_sum(array_map('array_sum', $matrix)); imageconvolution($image, $matrix, $divisor, 0); Result: http://bradleyboy.com/php-5.5.9-imageconvolution.jpg