![]() |
#1 |
Member
![]() Posts: 24
Karma: 10
Join Date: Jul 2022
Location: France
Device: Kobo Clara
|
![]()
I'm new to Sigil and would like to add vector graphics to epub (2 or 3).
I make SVG with inkscape. It works fine in Sigil preview (except for font), but Kobo displays only a part of it. I read various threads here and this code seems OK in the xhtml, but not the displayed SVG format: Code:
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin" version="1.1" viewBox="0 0 203 297" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"> <image height="297" width="203" xlink:href="../Images/drawing.svg"/> </svg> Here's the result on Kobo Clara: ![]() And here's the epub3: |
![]() |
![]() |
![]() |
#2 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,439
Karma: 5702578
Join Date: Nov 2009
Device: many
|
What happens if in the xhtml you replace that svg code with just an img tag with href pointing to your drawing.svg?
Also by default, Inkscape saves svg in its own format. Try re-saving the drawing in inkscape as standard svg 1.1 eliminating the width and height in the resulting svg file so it will scale to its parent tag properly. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,523
Karma: 167912829
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
One other item is if you send the file to your Kobo as a kepub, it will work happily.
|
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 24
Karma: 10
Join Date: Jul 2022
Location: France
Device: Kobo Clara
|
Thank you vey much KevinH and DNSB for your attention,
I forgot to say I tried various svg format with inkscape before writing this post. Actually rhe svg in the epub is plain 1.0 svg format. I think this actual svg format is correct because we can see the svg content. I also tried various XHTML tags, starting with <img/> in the past. I also tried changing .epub to .kepub.epub (.kepub alone is not seen by kobo) before posting. BUT, you were also both right ![]() Actually, having "ebook3.epub" AND a copy renamed "ebook3.kepub.epub" on the same device, Kobo didn't see the second as a "KOBO epub" but as a simple epub despite its name. Deleting the first one "forced" the device to see it as a KOBO epub. Secondly, my svg was 293px width. I didn't care since it's vector graphics and should scale fine whatever the original size. Except that scale doesn't seem to work at all. I made a copy of this SVG, this time scaled it up to 12000x10000px (same file size of course) and only kept minimum working tags in XHTML: Code:
<img alt="basicdrawing" width="100%" src="../Images/basicdrawing.svg"/> <img alt="basicdrawing" src="../Images/basicdrawing.svg"/> Of course, with these tags, I tried switching the filename to the previous one, and it didn't work, displaying small images. Width=100% is simply not working on Kobo. I guess I'd need to know the minimum acceptable width by Kobo to make svg illustrations working in Sigil preview and Kobo. Thank you for pushing me into re-trying all those parameters ![]() Cheers from France |
![]() |
![]() |
![]() |
#5 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,953
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
@philm, try adding the following CSS code to your eBook and see how the SVG works.
Code:
img { max-height: 100%; max-width: 100%; } |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,009
Karma: 89771343
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
I don’t know much about Kobo, but I know that an attribute of width="100%" is not correct HTML.
|
![]() |
![]() |
![]() |
#7 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,295
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
Not sure why you would consider that incorrect? (definition) It is simply saying the maximum width of the image is 100% of the parent container. If you don't specify a height, it will automatically adjust height to keep the proper aspect ratio. I regularly set a specific width and a max-width on my images and haven't had any issues with it. Code:
width:50%; max-width:1000px max-height:100% Last edited by Turtle91; 09-02-2022 at 04:44 PM. |
|
![]() |
![]() |
![]() |
#8 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 769
Karma: 1537886
Join Date: Sep 2013
Device: Kobo Forma
|
Quote:
Code:
.imgfull { /* Class for getting an image to take up most of screen */ height: 90%; background-position: center; background-repeat: no-repeat; background-size: cover; max-height: 100%; max-width: 100%; } |
|
![]() |
![]() |
![]() |
#9 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,295
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
It is preferred to have that in the CSS rather than the HTML. Ideally you would have ALL styling in your CSS and only structural elements in your html.
Code:
in the HTML tag: <img alt="basicdrawing" width="100%" src="../Images/basicdrawing.svg"/> in CSS: img {width: 10%; max-width: 1000px;} |
![]() |
![]() |
![]() |
#10 | |||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
preserveAspectRatio="xMidYMid meet" See if that fixes your Kobo rendering issue. Quote:
Or are you trying to do a "full-page image"... like a giant chart/graph? If a cover: Back in 2018, I showed why HTML "width=100%" and/or "height=100%" distorts especially when you turn your device landscape: If you're trying to get a "full-paged image", it depends on the case and what you're trying to accomplish. See a lot of my discussion of what to look out for in: - - - - If you want more info on SVGs specifically... RbnJrg has written a lot about SVGs + SVG Wrappers: or you can type this in your favorite search engine to find even more topics/examples: Code:
SVG RbnJrg site:mobileread.com SVG Tex2002ans site:mobileread.com So if you're going the SVG route, this solution would be an EPUB-only thing. Quote:
So sometimes I would have to:
That would usually get the version I wanted working again. ![]() Last edited by Tex2002ans; 09-02-2022 at 09:16 PM. |
|||
![]() |
![]() |
![]() |
#11 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,523
Karma: 167912829
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,295
Karma: 20171067
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
I know that was true at one time, but according to the current Image Guidelines they encourage SVG use:
Quote:
Have you seen kindles still having problems in recent testing??? edit: I did some more looking at the only restriction I found was that they require you to remove any SVG namespace references. Last edited by Turtle91; 09-02-2022 at 11:04 PM. |
|
![]() |
![]() |
![]() |
#13 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,009
Karma: 89771343
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
Quote:
|
|
![]() |
![]() |
![]() |
#14 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,953
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#15 | ||
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,651
Karma: 103503445
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Quote:
This Wikipedia extract is inaccurate: Quote:
px is not always a physical pixel I think cm (centimetre), in (inch) and mm (millimetre) should only be used in media Paper/Print. They make no sense on webpages or ebooks on screens. The pc (pica) is obsolete. Use em or if converting from docx to epub or html use pt (point) if the WP styles don't allow em. We use pt (and for images only % and px) for docx styles for ebooks and the copy docx for PDF export uses mm for page sizes, margins, padding, images etc. Never use px or mm etc etc for font sizes, only em or pt. |
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
can epub file images be centered using Sigil | provlima | Workshop | 2 | 04-23-2022 08:34 AM |
Sigil can't open my Epub file | Siegfried | Sigil | 2 | 05-27-2020 06:36 AM |
error from Sigil when loading particular epub file | JohnNC | Sigil | 15 | 08-08-2017 04:52 AM |
Vexing error in EPUB file created in Sigil | pstjmack | ePub | 7 | 08-02-2016 12:47 PM |
sigil doesn't open epub file | cyberbaffled | Sigil | 8 | 11-10-2009 03:28 PM |