|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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) }
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
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) }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?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();