php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59022 Imagick::setResolution() does not work for SVG-files anymore
Submitted: 2010-01-06 15:49 UTC Modified: 2010-02-28 07:41 UTC
Votes:17
Avg. Score:4.6 ± 0.7
Reproduced:14 of 14 (100.0%)
Same Version:7 (50.0%)
Same OS:3 (21.4%)
From: sualk at lednew dot de Assigned:
Status: No Feedback Package: imagick (PECL)
PHP Version: 2.3.0 (also 3.0.0b1, 2.2.1 and under some conditions 2.2.2) OS: Linux Ubuntu 9.10; php 5.3.1
Private report: No CVE-ID: None
 [2010-01-06 15:49 UTC] sualk at lednew dot de
Description:
------------
*Aim*: Resizing of vector graphics, pdf, ps, eps etc. WITHOUT Interpolation.

*by way of comparison the procedure in shell*: convert start.svg --density 123x123 end.png

*Procedure in php*: 
1. Create new Imagick-Object
2. set new Resolution
3. read Image

*Problem*: 
It works very fine for pdf, ps, eps etc. It DID work very fine for SVG-files too, while I used PHP 5.2.xx; ImageMagick 6.5.1 and Imagick-2.2.2

It did/does NOT work for SVG with:
PHP 5.2.xx; ImageMagick 6.5.1 and Imagick-2.2.1
PHP 5.3.1; ImageMagick 6.5.1 and Imagick-2.3.0
PHP 5.3.1; ImageMagick 6.5.1 and Imagick-2.2.2
PHP 5.3.1; ImageMagick 6.5.8 and Imagick-2.3.0
PHP 5.3.1; ImageMagick 6.5.8 and Imagick-3.0.0b1

Reproduce code:
---------------
<?php
$im = new Imagick();
$im->readImage("start.svg");
var_dump($im->getImageResolution());

$im->removeImage();
$im->setResolution(123,123);
$im->readImage("start.svg");
var_dump($im->getImageResolution()); // Shows old value, should be 123

// Also try with a pdf- or ps-file and it works perfectly!
?>


Expected result:
----------------
array(2) { ["x"]=>  float(72) ["y"]=>  float(72) }
array(2) { ["x"]=>  float(123) ["y"]=>  float(123) } 


Actual result:
--------------
array(2) { ["x"]=>  float(72) ["y"]=>  float(72) }
array(2) { ["x"]=>  float(72) ["y"]=>  float(72) } 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-07 03:57 UTC] sualk at lednew dot de
Chosen wrong package yesterday
 [2010-01-27 14:54 UTC] mkoppanen@php.net
I wonder whther this depends on which svg library the underlying ImageMagick uses. Testing locally here:

# php -dextension=imagick.so test.php
array(2) {
  ["x"]=>
  float(72)
  ["y"]=>
  float(72)
}
array(2) {
  ["x"]=>
  float(123)
  ["y"]=>
  float(123)
}
 [2010-02-28 07:41 UTC] mkoppanen@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2010-04-06 18:18 UTC] matt at raines dot me dot uk
I have this same problem on
PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7

Imagick::getVersion() reports:
array(2) {
  ["versionNumber"]=>
  int(1617)
  ["versionString"]=>
  string(68) "ImageMagick 6.5.1-0 2009-08-27 Q16 OpenMP http://www.imagemagick.org"
}

This is the current (stable) Ubuntu package "php5-imagick": 2.1.1RC1-1build2

How do I find out which SVG library ImageMagick uses?
 [2011-01-03 20:43 UTC] pembeci at gmail dot com
I have the same problem. Given code produces the wrong result. Please reopen the issue. It seems like I am not allowed to do it.

PHP : 5.2.11
imagick : 2.2.1-dev 
ImageMagick : 6.6.1

I couldn't find a specific library file related to svg in my ImageMagick distribution.
 [2012-01-05 05:52 UTC] jake dot lauer at gmail dot com
I am also having this problem still. PHP 5.2.17, ImageMagick 6.7.2-10, Imagick 3.0.1
 [2012-09-26 08:11 UTC] bernie dot spam at gmx dot at
Same problem here.

Imagick 3.1.0RC2 
ImageMagick 6.7.9-7 2012-09-25 Q16

On commandline it works fine: 
convert -density 500 source.svg target.png 

Same with imagick produces a low quality png, an set resulution is ignored: 

$im = new Imagick();
$im->setresolution(500,500);
$im->readImage("source.svg");
$im->setImageFormat("png");
$im->writeImage($path);
$im->destroy();
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 05:01:27 2024 UTC