View Single Post
Old 07-01-2017, 06:02 PM   #1
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,800
Karma: 103362673
Join Date: Apr 2011
Device: pb360
How to replace PNG images by SVG in epub?

I have been trying to substitute SVG images for PNG images in an epub off and on for three years (mostly off) with vey little (basically none) success. From time to time I learn or think of something to try, but I am now at the end of my rope.

The Creative Commons licensed book "Pro Git" by Scott Chacon has PNG illustrations, some of which are screen shots and many of which are line art diagrams with text. Naturally enough for an open source book about git, the source materials are in a git repository https://github.com/progit/progit (a second edition has since been published).

This is all fine, but the diagrams are tiny on high resolution screens. Iearned that the source for the diagrams is in dia format and get rendered into PNG. It turns out that dia can be rendered as SVG. So I unzipped the epub, deleted the diagram pngs, generated the svgs, change the <img src= in the html to refer to the svg files, and the media-type="image/png" to media-type="image/svg" in content.opf. (I've recently learned that it should have been media-type="image/svg+xml".) The rezipped and renamed epub worked great in FBreader in desktop linux but not in any dedicated reader or android tablet. The book text and screenshot PNGs would render, but the SVG diagrams would be completely absent or a small empty rectangle, depending on which reader application.

This inspired my question here 3 years ago. https://www.mobileread.com/forums/sh...d.php?t=242208

I had hoped that media-type="image/svg+xml" would be the magic cure, but all that did was get the built in "Reader" app on the NookHD. FBreader in Debian linux continued to work, but Android FBreader and Cool Reader continued to fail. I shouldn't really write fail since the epub itself fails epubcheck, but with puzzling error messages.

Epubcheck Version 3.0 said:
ERROR: progit-svg-xml-img.epub: I/O error reading 18333fig0101-tn.svg: Connection timed out
ERROR: progit-svg-xml-img.epub: I/O error reading 18333fig0102-tn.svg: Connection timed out
and so on...

Epubcheck Version 4.0.2 said:
Validating using EPUB version 2.0.1 rules.
FATAL(PKG-008): progit-svg-xml-img-auto.epub/18333fig0101-tn.svg(-1,-1): Unable to read file '18333fig0101-tn.svg'.
FATAL(PKG-008): progit-svg-xml-img-auto.epub/18333fig0102-tn.svg(-1,-1): Unable to read file '18333fig0102-tn.svg'.

So I am stumped and asking for help here.
My modified epub with SVG and original epub with all PNG attached.

Thanks for any help.
Attached Files
File Type: epub progit-svg-xml-img-auto.epub (1.86 MB, 545 views)
File Type: epub progit.epub (4.14 MB, 552 views)
j.p.s is offline   Reply With Quote