W
W
wrewolf2014-05-14 13:35:54
PHP
wrewolf, 2014-05-14 13:35:54

Why does ImageMagick svg to png give a white canvas?

There is a 5Mb svg file, inside a 256x256 rect filled with a texture, they are in the Textures folder, the paths to them are specified as Textures/testure_name.png
If you open the file in a browser, then everything is displayed normally. But it can't convert to png.
the command from the directory with the file itself and the texture folder convert file.svg file.png in centos produces a white sheet, similarly when converting inside the php script that generates this svg.
But at the same time, on Win8, the same command creates a png image perfectly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RPG, 2014-05-14
@RPG

CentOS has a very old version of ImageMagick, it is possible that this is the reason for the problems. The browser is not an indicator, since it has its own SVG engine. In Win8, the version is probably newer - compare the versions of the programs.
There are two exits.
* Find an RPM with an updated version of ImageMagick for CentOS or compile the latest version manually. True, it won't work with shared hosting - you simply won't be allowed to update the software on the server.
* Use another program that supports SVG, such as Inkscape.
PS Well, SVG for 5 megabytes is too much. If you have a virtual / dedicated server - it may be that it simply did not have enough memory. Watch the process of converting to top, if possible.

A
Alexey Devyatov, 2015-11-18
@SpekToR_ru

Version: ImageMagick 6.9.1-4 Q16 x86_64 2015-06-02
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib jbig jng jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib
Name: php56- php-pecl-imagick
Architecture: x86_64
Version: 3.2.0
Release: 0.9.RC1.el7.remi librsvg2
version:
Installed packages
Name: librsvg2
Architecture: x86_64
Version: 2.39.0
Release: 1.el7
Works if SVG and all its resources are in the same folder. The image path can be either absolute or relative. Accordingly, svg must be opened as a file, i.e. via $im->readImageBlob($svg->saveXML() will not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question