|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80369 getVectorGraphics () does not return an SVG-compatible string
Submitted: 2020-11-14 16:01 UTC Modified: 2020-12-16 13:01 UTC
From: lee dot traynor at skeptic dot de Assigned: danack (profile)
Status: Assigned Package: imagick (PECL)
PHP Version: 7.4.12 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: lee dot traynor at skeptic dot de
New email:
PHP Version: OS:


 [2020-11-14 16:01 UTC] lee dot traynor at skeptic dot de
From manual page:
"Returns a string which specifies the vector graphics"

However, the string returned, although a legal XML object, is not compatible with SVG.

Test script:
$draw = new ImagickDraw ();
$draw->setStrokeColor ("red");
$draw->setFillColor ("none");
$draw->rectangle (10, 10, 100, 100);
$doc = new DOMDocument ("1.0", "UTF-8");
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$doc->loadXML ($draw->getVectorGraphics ());
file_put_contents ("test_5.svg", $doc->saveXML ());

Expected result:
<?xml version="1.0"?>
  <rect x="10" y="10" stroke="#FF0000" fill="#000000" fill-opacity="0" width="90" height="90" />

Actual result:
<?xml version="1.0"?>
  <vector-graphics>stroke '#FFFF00000000'
fill 'none'
rectangle 10 10 100 100


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-15 13:20 UTC]
-Assigned To: +Assigned To: danack
 [2020-12-15 13:20 UTC]
> However, the string returned, although a legal XML object, is
> not compatible with SVG.

As far as I know, it is not supposed to be SVG.  Dan, can you
confirm?  If so, please assign back to me as documentation
 [2020-12-16 13:01 UTC]
Actually, I don't know.

I did spend some time before trying to figure it out, and it's one of those things that made me had to limit how much time I spend investigating instability around the underlying ImageMagick API's.

If I recall correctly (and only like 60% chance) the output depended either on which version of ImageMagick was used, or which svg renderer ImageMagick was compiled with; either Inkscape if it's available, or their own proprietary svg renderer.

The documentation is vague:

The behaviour between DrawGetVectorGraphics and DrawSetVectorGraphics has had........."excitingly dynamic stability" for a while:
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 14:01:29 2024 UTC