php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27756 ImageSetThickness + ImageArc = strange results
Submitted: 2004-03-29 10:44 UTC Modified: 2004-03-30 12:09 UTC
From: info at silisoftware dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.5 OS: Windows XP Pro
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: info at silisoftware dot com
New email:
PHP Version: OS:

 

 [2004-03-29 10:44 UTC] info at silisoftware dot com
Description:
------------
Drawing an arc with an image thickness of other than 1 produces very strange results. The thicker the line specified, the "hairier" it gets. At 5px it's uneven, 25px quite ragged, at 50px and above it gets very non-round. The best way I can show the problem is with some sample images:
http://www.silisoftware.com/temp/imagearc/

Not sure if it's a related issue, but I notice if I use the same code to draw an arc from 1-360 degrees, it looks like a big hairy "+" instead of a "o", but if I draw from 0-360 degrees it becomes a 1px circle, no matter what I specify for ImageSetThickness.

Reproduce code:
---------------
$imagethickness = 100;

$gdimg_output = ImageCreateTrueColor(400, 400);
$color_bg = ImageColorAllocate($gdimg_output,   0, 0, 255);
$color_fg = ImageColorAllocate($gdimg_output, 255, 0,   0);
ImageSetThickness($gdimg_output, $imagethickness);
ImageFilledRectangle($gdimg_output, 0, 0, 400, 400, $color_bg);
ImageArc($gdimg_output, 200, 200, 200, 200, 90, 360, $color_fg);
ImagePNG($gdimg_output);


Expected result:
----------------
100px thick, 270-degree red arc on blue background

Actual result:
--------------
This: http://www.silisoftware.com/temp/imagearc/100.png

270-degree red arc on blue background, but thickness varies from 1px to 100px, it looks "hairy", with a tendency to elongate into a "+" rather than a "o" (more pronounced the thicker the line is set to).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-30 12:09 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

That is the nature of the arc drawing algorithm inside the 
GD library. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 11:01:36 2025 UTC