after compiling and installing imagick for php8 (and working through the problems that causes to occur), I can now convert svgs to images. However, after installing inkscape and checking the delegations for imagick, imagick is not detecting and using inkscape. without any further errors to work through, and after going through plenty of google pages, I am convinced I either missed something that should be installed or configured, or I plainly did something wrong. I would appreciate any directions and/or assistance.
below you'll find information regarding versions, code and configurations, if anything else is required, please ask and I'm happy to provide.
grepping SVG renderers using convert -list format | grep SVG
gives me the 3 basic renderers (MSVG, SVG and SVGZ).
The php code used to render the final image is pretty basic and should not be related to the issue at hand, but here it is anyway:
class SvgRenderer
{
private static ?Crop $_crop = null;
private static Imagick $_im;
// ...
public static function stringToPng32($svg)
{
self::$_im = new Imagick();
self::$_im->setFont('../fonts/arial.ttf');
self::$_im->readImageBlob($svg);
self::$_im->setImageFormat('png32');
if(self::$_crop !== null) self::_applyCrop();
return self::$_im->getImageBlob();
}
// ...
}
The versions of php, inkscape and imagick are:
PHP: 8.0.9
Inkscape: 0.92.2
Imagick: 7.1.0-0
svg delegate rules:
<delegate decode="svg" command=""@RSVGDecodeDelegate@" -o "%o" "%i""/>
<!-- Change export-filename to export-png for inkscape < 1.0 -->
<delegate decode="svg:decode" stealth="True" command=""@SVGDecodeDelegate@" "%s" --export-png="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
The first image is rendered locally using imagick and inkscape, the second one is rendered on a server running the exact same code.
CodePudding user response:
After even more searching, I finally found what caused the issue... Inkscape 0.92 is the latest build for centos (not counting snap or other sandbox builds), which doesn't work with ImageMagick 7.0 downgrading to 6.9.33 fixed the issue.