php.net |  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
Votes:2
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
 [2012-04-22 00:35 UTC] naquad at gmail dot com
Description:
------------
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 6.7.6.2

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

  $draw = new ImagickDraw();
  $draw->setFontSize(17);
  $draw->setFillColor(new ImagickPixel('#000'));
  $draw->setFontStyle(imagick::STYLE_NORMAL);
  $draw->setFontWeight(400);
  $draw->setStrokeColor(new ImagickPixel('transparent'));
  $im->annotateImage($draw, 101, 52, -90, 'test'); // 101 here is on purpose to show the bug more explicitly                                                                                                                                                                     
  $im->drawImage($draw);

  $im->writeImage('1.png');


Actual result:
--------------
http://i40.tinypic.com/2i7a0w4.png

Patches

Pull Requests

History

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] mike@php.net
-Assigned To: +Assigned To: mkoppanen
 [2015-01-02 22:18 UTC] Danack at basereality dot com
Hi,

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' \
61806Convert.png


This also shows a blank column on the right edge of the image. I have reported this upstream:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26824
 [2015-02-07 02:56 UTC] danack@php.net
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="http://www.w3.org/2000/svg" xml:space="preserve" width="60" height="60" viewBox="0 0 60 60" xmlns:xlink="http://www.w3.org/1999/xlink">
  <text x="0" y="70" fill="red" font-size="96" >test</text>
</svg>

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] danack@php.net
-Status: Assigned +Status: Wont fix
 [2015-04-01 16:22 UTC] danack@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 25 10:01:32 2024 UTC