05-20-2014, 08:47 PM | #1 |
Read, don't parrot.
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
|
SVG wrapper not read by iBooks and Sony
I did a book for a friend; the book has photos, but they're not the best quality, so I put them in SVG wrappers to prevent upsampling. The wrapper is the standard fare:
Code:
<div class="Image"> <svg xmlns="http://www.w3.org/2000/svg" style="max-width:720px; max-height:960px" width="75%" preserveAspectRatio="xMidYMid meet" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 720 960" > <image alt="" width="720" height="960" xlink:href="../Images/cover.jpg"></image> </svg> </div> I have heard that some devices have issues with SVG wrappers, but I'm stumped about iBooks. I'm not sure if this is part of the issue, but when I code the books as such in Sigil for PC, the SVG wrapper remains as is. But when opened/saved in Sigil for Mac, the style is removed and turned into this and added to the header code: Code:
<style type="text/css"> svg.sgc-1 {max-height:960px; max-width:720px} </style> |
05-21-2014, 04:11 AM | #2 |
Addict
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Code:
<svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="none" version="1.1" viewBox="0 0 720 960" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"> <image height="100%" width="100%" xlink:href="../Images/cover.jpg"></image> </svg> |
Advert | |
|
05-21-2014, 01:04 PM | #3 |
Read, don't parrot.
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
|
Will try that and send a new file to my friend and have him check it on his Mac. Will report back once I have a response.
Thanks! |
05-21-2014, 01:13 PM | #4 |
Read, don't parrot.
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
|
Sorry, spoke too soon. I have read that "none" as an aspect ratio causes problems. Also, I don't want the image to fill the screen, so 100% is not correct; I want the 75% and I need the max height and width values to prevent upsampling. But more importantly, what is the reason for repeating the 100% in height and width values in both the svg xmlns and the image code? I don't understand.
|
05-24-2014, 02:03 PM | #5 |
Read, don't parrot.
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
|
I think I understand your code - the 100% in image is not the container but the image size; but in any case I tried the code and it doesn't work in ADE or my other devices - the images are distorted. I need something that will work in both my ePub devices and iBooks.
BTW, I got a closer look at what is happening in iBooks and the pictures are displaying but are running over two screens if the image doesn't fit. Any other suggestions welcome. |
Advert | |
|
05-25-2014, 03:11 AM | #7 |
Read, don't parrot.
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
|
Alas, the thread has not provided a solution. When I tried your code the result in iBooks (on my friend's Mac) was identical to the original code: the pictures are split over screens instead of shrunk to fit. I think this is a bug with the iBooks app.
In ADE, the new code results in distorted images. In Sigil, the images disappear from the screen though they do appear in the book when viewed in ADE. We tried the original book on his son's newer model Sony Reader and the pictures are fine. So it seems to be a case of an older model Sony and a buggy Apple app. Since the images work well on everything else that we tested, we've decided to leave it alone. It's a bit like complaining that your old DVD player doesn't play BlueRay: suck it up and buy a new DVD player then. As for Apple, they're always contrary and there isn't much one can do about that. Thank you for your suggestions, though. The help was appreciated and it gave me something to work with. |
05-25-2014, 03:18 AM | #8 |
Addict
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Well, it seems like you're still stuck, how about upload the epub or an image that's causing your problems and i'll try to fix it?
|
05-25-2014, 07:04 AM | #9 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
The idea that a reader should ditch their serviceable but older Apple product for a mere $500US for one that will read your content doesn't seem practical. Even at $150 or so it doesn't.
They are doing you a favor by reading what you create, not the other way around. |
05-25-2014, 03:32 PM | #10 |
Read, don't parrot.
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
|
Mrmikel: it's Apple iBooks app, not a device. The device in question is an older Sony Reader. And one cannot code for everything; it's become impossible. It's the nature of the technological beast: the speed of change and the vagaries of device programming mean that even what is considered "standard" code is not read equally across devices. In this case, the code works on everything we tested except someone with an old Sony Reader sees the text overlaying the image. There's nothing I can do about it: if I fix that problem for a minority user set, I create a new one for the majority of users. And once someone decides to go digital, they have to accept that, as with all things digital, obsolescence is their problem; they cannot get angry at content creators because the content doesn't display on an older device.
odeta: thanks for the offer. The problem is merely that the standard SVG code that I used to control the image size (particularly to prevent upsizing in high-resolution devices -- the images are a mere 960 x 720 pixels) has this problem on iBooks and this old Sony Reader. That's the only negative feedback I've had on this SVG wrapper. As noted, iBooks seems to have a problem with SVG wrappers period; the only way to get the image to shrink to fit in iBooks is to take it out of the wrapper. I have another idea, which is to put the max-height and -width in the CSS, and see if I can control the upsizing by using just a Div instead of SVG. I tried a version of that yesterday with no success, but I have another idea today. If it works I will report back. |
05-25-2014, 04:09 PM | #11 |
Addict
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Alright, waiting for your report.
I also remembered about a conversation we had a week ago or so, maybe that will help. |
05-25-2014, 05:39 PM | #12 |
Read, don't parrot.
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
|
Hi odeta:
I'm at a loss. to reiterate the quandary: I want to specify image height to avoid images getting cut off in devices that do not automatically shrink to fit, AND avoid upsampling in high-res devices. The SVG wrapper solved both issues. BUT as this thread indicates, the wrapper is not read uniformly across iBooks or some older ePub readers. So the challenge is to achieve the same thing without SVG. My image div sets the page alignment and adds a bottom margin: Code:
div.Image {text-align:center; margin-bottom:1em;} Code:
.image1 {max-height:500px; max-width:375px;} Code:
<div class="Image"><img alt="0425" class="image1" height="75%" src="../Images/0425.jpg" /></div> If I try to add that value to the image class: Code:
.image1 {height:75%; max-height:500px; max-width:375px;} I tried just making everything a style override: Code:
<div class="Image"><img alt="0425" style="height:75%; max-height:250px; max-width:188px" src="../Images/0425.jpg" /></div> I tried: Code:
<div class="Image"><img alt="0425" height="75%" style="max-height:250px; max-width:188px" src="../Images/0425.jpg" /></div> If you have a magic code to solve this dilemma, I would love to hear of it. I'm batting zero. |
05-25-2014, 05:59 PM | #13 |
Addict
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Did you try the solution I offered verydeepwater on that thread?
Create a paragraph or a div with class image as such: Code:
<p class="image"><img src="../Images/image3.jpg" alt="" /></p> Code:
.image { max-width: 99%; max-height: 99%; padding:0; margin:0; } Code:
max-height: 99%; Last edited by odedta; 05-25-2014 at 06:22 PM. |
05-25-2014, 10:31 PM | #14 |
Enthusiast
Posts: 34
Karma: 10
Join Date: Oct 2008
Location: Honolulu
Device: iPod Touch, Nexus tablet
|
I also am having problems with SVG code
I edit in Oxygen, an XML editor (lets me work inside the zipped epub folder). It flags this code as incorrect:
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd'> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="../styles/style001.css" type="text/css" /> <title>Chords</title> </head> <body> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 400 581" preserveAspectRatio="xMidYMid meet"> <image width="400" height="581" xlink:href="../images/chords_cover.jpeg" /> </svg> </body> </html> Oxygen wants me to define image and svg. However, this code seems to work in all ereaders except the iPad. I am wondering if fixing the definition problem, so that the code passes muster with Oxygen, will also fix the iPad problem. Please, Obi Wan Kenobi, you're my only hope. |
05-26-2014, 12:22 AM | #15 |
Read, don't parrot.
Posts: 224
Karma: 110242
Join Date: Apr 2011
Device: Kindle Fire, Kobo Touch, Aldiko for Android
|
Odedta:
The suggested code doesn't stop the images from being cut off in ADE. The only way I've been able to prevent that is to include the height percentage inside the image code directly: <div class="Image"><img alt="0425" height="75%" src="../Images/0425.jpg" /></div> or indirectly via an image class: <div class="Image"><img alt="0425" class="image1" style="max-height:250px; max-width:188px" src="../Images/0425.jpg" /></div> where "image1" has the percentage specified. Putting the percentage in the opening div class isn't being read by ADE. Don't know why. Also, I don't see how your code would prevent upscaling in high-res devices. If the max-height or width is set to 99%, then that would be 99% of the screen, correct? A 960-pixel image would then be upscaled to about 2000 pixels in an iPad. |
Tags |
ibooks, sony, svg |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Svg wrapper and image resizing | Nabodita | ePub | 24 | 05-02-2014 12:21 AM |
How can hyperlinks be added inside SVG wrapper? | GrannyGrump | Workshop | 9 | 03-03-2014 06:14 AM |
Need Example SVG wrapper including caption | GrannyGrump | ePub | 30 | 11-06-2013 03:20 AM |
Adding an SVG Wrapper | ghostyjack | Sigil | 16 | 06-15-2013 05:13 AM |
An Issue about a SVG wrapper | RbnJrg | Kindle Formats | 29 | 06-10-2013 08:11 PM |