Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable SVG support for Imagemagick in DDEV

I need to do some SVG manipulation, specifically create PNG thumbnails from SVG icons. This works fine when running the site through MAMP, but not when running it through DDEV.

When running convert -list configure it justs it as --without-rsvg, which I assume means it doesn't configure imagemagick to run with rsvg support. It also does not list SVG as a supported format when running convert -list format.

As explained by Randy Fay, DDEV's web container runs as a Debian Stretch, so while the question is specifically for DDEV, it can also be relevant to enabling support on Debian Stretch containers in general.

Question: How to I enable SVG support for Imagemagick?

like image 553
Dion S. Jensen Avatar asked Oct 28 '25 05:10

Dion S. Jensen


2 Answers

After some chat with Randy Fay on slack, he suggested adding the following to my config.yaml

webimage_extra_packages: [libmagickcore-dev]

After doing that and a restart of the projet, it adds SVG support and everything now works as expected.

This was a very quick fix, so many thanks to Randy Fay for helping out.

like image 130
Dion S. Jensen Avatar answered Oct 30 '25 14:10

Dion S. Jensen


Actually, it's enough to install the libmagickcore-6.q16-6-extra package, which adds support for SVG to imagemagick (cf. apt show libmagickcore-6.q16-6-extra). It solves the problem both for convert command and php-imagick PHP module.

like image 28
Fabien Avatar answered Oct 30 '25 14:10

Fabien



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!