LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

external SVGs may be up/downscaled by factor 1.33333 (ImageMagick bug)

Open xworld21 opened this issue 11 months ago • 0 comments

This is an ImageMagick bug, not a LaTeXML one, but it explains a lot of the quirks in the code, like https://github.com/brucemiller/LaTeXML/blob/f82b733eade2c81f24567c349929f2a696cb66cb/lib/LaTeXML/Post/LaTeXImages.pm#L48 The 1.33333 is clearly converting from points to pixels, which shouldn't be necessary!

It turns out that ImageMagick's internal SVG decoder will return the image size without considering the units. dvisvgm writes width and height using points, so that's what you get for math images, for instance. However, if ImageMagick is using rsvg-convert, it will return the pixel size. So what happens depends on the system running LaTeXML!

I am not sure how LaTeXML can detect this, but it would be nice if it did, since I don't think it'll get fixed in the wild.

Edit: or LaTeXML could just read the size directly from the SVG and bypass the issue altogether.

xworld21 avatar Jan 01 '25 13:01 xworld21