php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42685 imagefilledellipse wrong size
Submitted: 2007-09-17 04:41 UTC Modified: 2008-11-10 01:00 UTC
Votes:7
Avg. Score:4.4 ± 0.7
Reproduced:7 of 7 (100.0%)
Same Version:4 (57.1%)
Same OS:5 (71.4%)
From: chinhnt2k3 at yahoo dot com Assigned: pajoye (profile)
Status: No Feedback Package: GD related
PHP Version: 5.2.4 OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: chinhnt2k3 at yahoo dot com
New email:
PHP Version: OS:

 

 [2007-09-17 04:41 UTC] chinhnt2k3 at yahoo dot com
Description:
------------
imagefilledellipse() produces an ellipse with a different size if the size is even.

Reproduce code:
---------------
<?php

$image = imagecreatetruecolor(200, 200);
$color = imagecolorallocate($image, 255, 255, 255);
imagefilledellipse($image, 100, 100, 26, 26, $color);
header("Content-type: image/png");
imagepng($image);

?>

Expected result:
----------------
An ellipse with the size of 26.

Actual result:
--------------
An ellipse with the size of 27.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-06 11:28 UTC] kalle@php.net
The same effect occurs for the imageellipse(), I belive this bug is in libgd
 [2008-11-02 13:04 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-11-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-03-27 18:01 UTC] andrew at ameshome dot ca
I can confirm this still occurs in PPH 5.2.9-1

An elipse with an even size is rounded to an odd size
 [2009-06-18 07:19 UTC] schwarzenneger at hotmail dot com
Reproduced error on the following:

* PHP Version 5.2.5
* GD Library bundled (2.0.34 compatible) 
** IIS 5.1 on Windows XP Professional
** Apache/2.2.9 (Win32) on Windows XP Professional

Reproduce code:

<?php
  $radius = 100;

  $corner_image = imagecreatetruecolor(
    $radius * 2,
    $radius * 2
  );

  $clear_colour = imagecolorallocate(
    $corner_image,
    0,
    0,
    0
  );

  $solid_colour = imagecolorallocate(
    $corner_image,
    0xFF,
    0,
    0
  );

  imagefill(
    $corner_image,
    0,
    0,
    $solid_colour
  );

  imagefilledellipse(
    $corner_image,
    $radius,
    $radius,
    $radius * 2,
    $radius * 2,
    $clear_colour
  );

  header( "Content-type: image/png" );
  imagepng( $corner_image );
?>

Expected output:
* 200x200 black circle inside 200x200 red square, perfect fit

Actual output:
* 201x201 black circle inside 200x200 red square, the right side of circle clearly appears "clipped"
 [2009-06-18 07:32 UTC] schwarzenneger at hotmail dot com
Read the last line of the previous comment as follows:

* 201x201 black circle inside 200x200 red square, the right and bottom sides of the circle appear "clipped" by one pixel
 [2009-06-25 07:06 UTC] schwarzenneger at hotmail dot com
Here is the output from the above script.

radius = 100px, canvas size = 200x200px
http://img235.imageshack.us/img235/9236/radius100canvas200.png

radius = 100px, canvas size = 201x201px
http://img235.imageshack.us/img235/3249/radius100canvas201.png

I believe there is enough feedback on this and the bug should be re-opened.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 20:01:29 2024 UTC