|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61806 Imagick::annotateImage and ImagickDraw::annotation clip last pixel in image
Submitted: 2012-04-22 00:35 UTC Modified: 2015-04-01 16:22 UTC
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: naquad at gmail dot com Assigned: mkoppanen (profile)
Status: Wont fix Package: imagick (PECL)
PHP Version: 5.3.10 OS: Linux x86_64
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: naquad at gmail dot com
New email:
PHP Version: OS:


 [2012-04-22 00:35 UTC] naquad at gmail dot com
Annotations don't use last pixel of the image (actual result).
It looks like its clipped or its some rounding error, but same code in Ruby + 
RMagick works ok.

ImageMagick is

Test script:
  $im = new Imagick();
  $im->newImage(100, 100, new ImagickPixel('white'), 'JPEG');

  $draw = new ImagickDraw();
  $draw->setFillColor(new ImagickPixel('#000'));
  $draw->setStrokeColor(new ImagickPixel('transparent'));
  $im->annotateImage($draw, 101, 52, -90, 'test'); // 101 here is on purpose to show the bug more explicitly                                                                                                                                                                     


Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-22 00:39 UTC] naquad at gmail dot com
Oh, also imagick module version is 3.0.1
 [2013-12-03 11:30 UTC]
-Assigned To: +Assigned To: mkoppanen
 [2015-01-02 22:18 UTC] Danack at basereality dot com

I believe Imagick is actually showing the same behaviour as ImageMagick does when running an equivalent command:

convert \
-size 100x100 xc:white \
-pointsize 17 \
-weight 400 \
-fill black \
-stroke none \
-annotate 270x270+101+52 'test' \

This also shows a blank column on the right edge of the image. I have reported this upstream:
 [2015-02-07 02:56 UTC]
I don't believe this issue is caused by Imagick or ImageMagick. It is being caused by the underlying software used to render the SVG file into an image - which is how ImageMagick draws text and other primitives.

Converting this SVG:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="" xml:space="preserve" width="60" height="60" viewBox="0 0 60 60" xmlns:xlink="">
  <text x="0" y="70" fill="red" font-size="96" >test</text>

with Inkscape version 0.47 shows the same issue. I think I'll leave the issue open for now as it's probably going to affect other people and it ought to be retested against a newer version of Inkscape or other SVG converter, when possible.
 [2015-04-01 16:22 UTC]
-Status: Assigned +Status: Wont fix
 [2015-04-01 16:22 UTC]
Yep, I tested against a different SVG library, and the image generated was correct.

If you see this error in generated images, you need to upgrade whichever delegate library you are using to generate SVG images.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Feb 07 12:03:42 2023 UTC