spatie / laravel-medialibrary

Associate files with Eloquent models
https://spatie.be/docs/laravel-medialibrary
MIT License
5.78k stars 1.08k forks source link

Fix SVG files loosing transparency during conversion #3728

Open nicolasbeauvais opened 13 hours ago

nicolasbeauvais commented 13 hours ago

Hello,

When running a media conversion against an SVG file to another file format that support transparency such as PNG or WEBP, conversions will lose any transparency and force a white background.

Two modifications were needed to make it work:

I tested this change on PHP 8.3 / Imagick 1809 / ImageMagick 7.1.1-41 on Fedora Linux.

The PNG format of png32 was the one previously used before this commit, I guess 32 is good enough for most SVG use-cases.