Open wojoj93 opened 1 year ago
Can you provide the original SVG as an svg, rather than the PNG that is appears to be on github?
Also, can you say how you installed Imagick please?
Thank you for your reply. Here is an original svg:
Installation process:
RUN apt-get install -y libmagickwand-dev \ && pecl install imagick \ && docker-php-ext-enable imagick COPY imagick/policy.xml /etc/ImageMagick-6/policy.xml
Okay, I get the same error using Imagick/ImageMagick.
I'd suggest opening an issue at their repo here: https://github.com/ImageMagick/ImageMagick6
However....you probably just want to get your stuff working.
There have been so many SVG problems with ImageMagick, I pretty strongly recommend using Inkscape to convert files instead of Imagick/ImageMagick.
inkscape can be install through apt and then to convert a file, it needs to be invoked with something like:
inkscape "old.svg" --export-filename="./output_inkscape_directly.png" \
--export-dpi="96" \
--export-background="white" \
--export-background-opacity="255" > inkscape_output.txt 2>&1
I should probably write this down in the docs.
Inkscape is a dedicated SVG converter, it's always going to be more reliable than ImageMagick, where the maintainers have many other things to worry about.
hi, I have a problem with converting svg file to jpg/png via imagick: here is code:
$image = new \Imagick(); $image->readImage('old.svg'); $image->setImageFormat('png'); $image->setImageCompressionQuality(100); $image->writeImage('new.png'); $image->destroy();
result: SVG: PNG/JPG:
Could someone tell me what I do wrong?