Closed agrahn closed 4 months ago
(Just some doc searching and reading, I don't have access to --embed-bitmaps
because dvisvgm 3.0 is not available to macOS users and I'm not able to build it myself (yet).)
The manpage https://dvisvgm.de/Manpage/ says
This option only affects bitmaps referenced in DVI/XDV files, e.g. added by
\includegraphics
.
hence I go to the graphics
driver file for dvisvgm
(dvisvgm.def
) and find in \Ginclude@bitmap
, \special{dvisvgm:bbox ...}
and \special{dvisvgm:raw ...}
are used.
https://github.com/latex3/graphics-def/blob/082eb8c28da564c622b08097fdd7e10658d46a31/dvisvgm.def#L162-L184
BTW in manpage there're missing --
before embed-bitmaps
.
I probably should add more details to the manpage about this. At the moment, --embed-bitmaps
only affects psfile
and pdffile
specials as created by \includegraphics
is PS mode, for example. dvisvgm:img
still creates file references, but I plan to extend the embed functionality so that it covers this special as well.
BTW in manpage there're missing
--
beforeembed-bitmaps
.
Thanks for the hint. I've fixed it.
The manpage https://dvisvgm.de/Manpage/ says
This option only affects bitmaps referenced in DVI/XDV files, e.g. added by
\includegraphics
.hence I go to the
graphics
driver file fordvisvgm
(dvisvgm.def
) and find in\Ginclude@bitmap
,\special{dvisvgm:bbox ...}
and\special{dvisvgm:raw ...}
are used. https://github.com/latex3/graphics-def/blob/082eb8c28da564c622b08097fdd7e10658d46a31/dvisvgm.def#L162-L184
I know this, as I loosely co-maintain dvisvgm.def
and which is the reason why I am asking. I finally want to replace the dvisvgm:raw
special with the dedicated dvisvgm:img
special. However, the current method allows me to easily "patch" the driver code at document level in order to physically embed bitmaps as data blobs. For example: https://tex.stackexchange.com/a/580847
I finally found some time to enhance the evaluation of dvisvgm:img
so that it works similar to special psfile
. The syntax is still the same but bitmaps can now optionally be embedded into the generated SVG files by using option --embed-bitmaps
.
The previous implementation seemed a bit buggy because image position and bounding box didn't match. I fixed this as well. The lower left corner of the image is now placed at the current DVI position (if the current transformation matrix is the unity matrix), so that the image sits on the baseline. Also, the images and their bounding boxes are transformed according to the current matrix. I hope that these improvements make the special a bit more useful.
I finally found some time to enhance the evaluation of
dvisvgm:img
so that it works similar to specialpsfile
. The syntax is still the same but bitmaps can now optionally be embedded into the generated SVG files by using option--embed-bitmaps
. .. Also, the images and their bounding boxes are transformed according to the current matrix. I hope that these improvements make the special a bit more useful.
This sounds very promising! Thank you! I will be testing this soon.
I tried PNG inclusion with the
dvisvgm:img
special and using the--embed-bitmaps
option withdvisvgm
, v. 3.0.2. The resultingimage
tag in the SVG output still contains anxlink:href=...
link to the PNG instead physically embedding it as adata:image...
blob. Am I missing something?