Skip to content

Instantly share code, notes, and snippets.

@binaryhq
Forked from alinmigea/imagick-svg2png.txt
Last active July 8, 2021 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binaryhq/e5e6a16f620a56c924711911c0aeb2b8 to your computer and use it in GitHub Desktop.
Save binaryhq/e5e6a16f620a56c924711911c0aeb2b8 to your computer and use it in GitHub Desktop.
PHP: Use Imagick to convert SVG chart to PNG
Commands for installing the server library:
sudo apt-get install php7.0-imagick
sudo apt-get update
sudo service apache2 restart
Errors:
Caught exception: no decode delegate for this image format `' @ error/blob.c/BlobToImage/
use the following, because it might be that you don't have the MIME tyep SVG installed:
sudo apt-get install libgraphicsmagick1-dev libmagickcore-dev libmagickcore-6.q16-2 libmagickcore-6.q16-2-extra
for php-7.3.6 : sudo apt-get install libgraphicsmagick1-dev libmagickcore-dev libmagickcore-6.q16-3 libmagickcore-6.q16-3-extra
for php-7.4 : sudo apt-get install libgraphicsmagick1-dev libmagickcore-dev libmagickcore-6.q16-6 libmagickcore-6.q16-6-extra
identify -list format | grep SVG
Output: MSVG SVG rw+ ImageMagick's own SVG internal renderer
Usefull links:
https://stackoverflow.com/questions/13125352/readimageblob-fatal-error-when-converting-svg-into-png/15614469#15614469
https://github.com/gographics/imagick/issues/97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment