03-12-2015, 09:03 PM | #1 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Display of a png image linked to a svg image
Hi
I had a curious experiment. Using Inkscape, I linked a png image to a svg image (containing lines of text shaped around the png). I saved as a simple svg file. I inserted both images in an EPUB with an embedded font. I updated the link (href...) for the png image within the svg file using the Editor which helped me with its violet color. Pity: the editor did not display the linked png file, only the svg one. Even the Calibre viewer refused to display it... I imported the unchanged EPUB in Calibre. I exported it to PDF format using the Prince PDF plugin of Jellby and it worked perfectly. I can reproduce it: I have a nice PDF with a perfect display of my combined images (png within svg). This seems to show that the EPUB code is sound. My question is: what should I do so that the display could also take place on one EPUB? Is this a missing feature? Last edited by roger64; 03-13-2015 at 07:26 AM. Reason: typo |
03-12-2015, 10:41 PM | #2 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
As far as I know, there is no problem whatsoever, displaying raster image formats linked to from svg. That is how, the standard calibre covers work after all. I suggest you attach an example book.
|
Advert | |
|
03-12-2015, 11:58 PM | #3 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi,
Thanks for your reply. So, I am missing something. Here is the EPUB (two pages...) and the PDF. The png files are said "not referenced" though they are reported in the link within the svg file and appear in the .opf file too. EPUBCheck seems reasonably happy (and I know how much you value it). Last edited by roger64; 03-13-2015 at 06:24 AM. |
03-13-2015, 12:39 AM | #4 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Dont put your svg into its own file, instead embed it directly in the HTML. IIRC there are various issues with using svg files referred to from <img> tags. This is likely one of them. That will also fix the unreferenced error you get.
EDIT: For example, if I open up your chapter.xhtml file in Firefox,the PNG is not rendered there either. You will likely have to use <svg> inside the html to get it to work reliably. Last edited by kovidgoyal; 03-13-2015 at 12:44 AM. |
03-13-2015, 03:18 AM | #5 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thanks for your reply.
I apologize for not understanding it. I tried to set up a snippet for a svg tag I've found on the web,. After a complaint about namespace missing, I added a bunch of them, but the Editor still reports the png files as unreferenced. This is the tag i inserted in the xhtml file for the first svg image: Code:
<svg width="471" height="693" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <image xlink:href="enfant2.svg" width="471" height="693"/> </svg> |
Advert | |
|
03-13-2015, 03:47 AM | #6 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You need to embed the entire contents of the svg file inside the html. Not a reference to the svg file.
|
03-13-2015, 06:21 AM | #7 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thank you for your patience with me: it works
The Editor complains about a lot about invalid values (namely text-align:start), many unknown properties (stroke, fill, etc.) but it references the png files. Epubcheck complains only about some namespaces. The EPUB displays fine on the Calibre viewer and the PDF can still be produced. Last edited by roger64; 03-13-2015 at 07:29 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
svg image on top of a background png image | roger64 | ePub | 25 | 04-24-2015 11:00 AM |
Image Not Visible - Using SVG | SeaCanary | Sigil | 23 | 05-16-2014 07:51 PM |
Scaling up an image via SVG | Kayto | ePub | 27 | 01-26-2013 03:38 AM |
svg image inside span tag in mobi file not display numbers | Hala Aly | Workshop | 3 | 09-12-2012 08:00 AM |
hotlinking png image | bobcdy | Sigil | 21 | 09-21-2010 04:56 AM |