Why is ImageMagick treating SVG differently when piped in?

Viewed 74

I have a file q.svg which is transparent (at least at the top left). Here's a command and its result:

$ convert -verbose -background "#ffffff00" q.svg -depth 8 RGBA:- | ruby -e '$stdin.binmode;p $stdin.read(4)'

'inkscape' '/tmp/magick-18391tJtIEDjjRpHh' --export-png='/tmp/magick-18391Wt5UBvmqqzoj' --export-dpi='96,96' --export-background='rgb(100%,100%,100%)' --export-background-opacity='0' > '/tmp/magick-18391_rpBcJRZuR3k' 2>&1
/tmp/magick-18391Wt5UBvmqqzoj PNG 640x384 640x384+0+0 8-bit sRGB 3413B 0.040u 0:00.029
/tmp/work/q.svg SVG 640x384 640x384+0+0 8-bit sRGB 3413B 0.000u 0:00.010
"\x00\x00\x00\x00"

The pixel is black fully transparent. I specified white as background color but as it's fully transparent, this is fine for me.

Now I run the command differently, by piping my input to convert:

$ cat q.svg | convert -verbose -background "#ffffff00" SVG:- -depth 8 RGBA:- | ruby -e '$stdin.binmode;p $stdin.read(4)'

'inkscape' '/tmp/magick-18396DKgnVvgUiunU' --export-png='/tmp/magick-18396vzaREmaEV3VO' --export-dpi='96,96' --export-background='rgb(100%,100%,100%)' --export-background-opacity='0' > '/tmp/magick-18396hHG-MP4569rJ' 2>&1
mvg:/tmp/magick-18396ZW9toKj2UPw8=>/tmp/magick-18396ZW9toKj2UPw8 MVG 640x384 640x384+0+0 16-bit sRGB 669B 0.280u 0:00.280
SVG:-=>- MVG 640x384 640x384+0+0 16-bit sRGB 669B 0.000u 0:00.010
"\xFF\xFF\xFF\x00"

The result is different now, and the process is different apparently - some MVG appears in the verbose log. Why is this different?! Some pixels (that were not transparent in the SVG) are actually incorrect this time in the full result.

If I specify the input as - instead of SVG:- I get back the behaviour from the first example apparently. So I can probably get the result I want by some trickery, but I'd prefer to understand what's going on. How is the "input engine" or whatever selected? Why is MVG involved, even after running inkscape? What input type should I use to get the SVG parsed correctly if I really want to specify it?

Version info:

$ convert -version
Version: ImageMagick 6.9.10-23 Q16 arm 20190101 https://imagemagick.org
0 Answers
Related