php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77943 imageantialias($image, false); does not work
Submitted: 2019-04-25 10:56 UTC Modified: 2019-04-30 08:15 UTC
From: andrew dot moyns at sanofi dot com Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 7.3.4 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: andrew dot moyns at sanofi dot com
New email:
PHP Version: OS:

 

 [2019-04-25 10:56 UTC] andrew dot moyns at sanofi dot com
Description:
------------
PHP 7.3.4 nts 64bit

Unable to turn off antialiasing for an image, resulting in inability to draw lines with thickness > 1

Expected operation is observed in PHP 5.5.38


Test script:
---------------
<?php
    header('Cache-Control: no-cache');
    header('Content-type: image/png');
    
    $width = 400;  $height = 300;
    $im = imagecreatetruecolor($width, $height);
    $white = imagecolorallocate($im, 255, 255, 255);
    $blue = imagecolorallocate($im, 0, 0, 255); 
    
    imageantialias($im, false);
    imagefilledrectangle($im, 0, 0, $width-1, $height-1, $white);
  
    imageline($im, 0, 0, $width, $height, $blue);
    imagesetthickness($im, 3); 
    imageline($im, 10, 0, $width, $height-10, $blue);
  
    imagepng($im);
?>

Expected result:
----------------
PNG image showing two blue lines, not antialiased, one 1 pixel wide, one 3 pixels wide

Actual result:
--------------
PNG image showing two blue lines, antialiased, both 1 pixel wide.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-25 12:50 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2019-04-25 12:50 UTC] cmb@php.net
Thanks for reporting.  Indeed, this is broken as of PHP 7.2.0[1].
(Not calling imageantialias() would work around the problem for
your code.)

[1] <http://git.php.net/?p=php-src.git;a=commit;h=d0f14a4429e36d8cb70d14067e79fd252eb4ee7a>
 [2019-04-29 14:20 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cd94cf60a2379ccfe4619b1b9384a68b3e7a1205
Log: Fix #77943: imageantialias($image, false); does not work
 [2019-04-29 14:20 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2019-04-29 15:25 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=18a9ae412f00cc1e312c296952fac24f16b4d4de
Log: Fix #77943: imageantialias($image, false); does not work
 [2019-04-30 08:15 UTC] andrew dot moyns at sanofi dot com
That's great, many thanks for the quick response.  Hope to see it in a new release soon!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 30 03:01:31 2025 UTC