05-16-2017, 08:07 PM | #1 |
Connoisseur
Posts: 60
Karma: 602194
Join Date: Apr 2017
Device: Ipad
|
Image Width in Contents Pane
I would like svg images included in my book to utilise the maximum screen space of whatever device the reader is using, so my stylesheet says,
Code:
div.image { width:100%; margin:2em auto; text-align:center; } img { max-width:100%; max-height:100% } Has anyone encountered this problem, and if so, can I get a fix please? |
05-17-2017, 04:00 AM | #2 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
It is not an Sigil issue. The best way to use the maximum screen space is to use a wrapper. The code for that is also used for covers in Sigil. That is the same answer you got in the ePUB forum.
Also, you have a margin specified for the div containing the image, so the complete screen will never be used. That is even besides the potential margin for the body and html tags. Another point, the auto value does not really work for a lot of readers It will be interpreted as being 0 (this in accordance to the ePUB specifications). |
Advert | |
|
05-17-2017, 10:34 AM | #3 |
A Hairy Wizard
Posts: 3,222
Karma: 19000635
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
|
That is true - the fix is to combine it with text-align:center to catch all those pesky 'substandard' readers.
|
05-17-2017, 02:43 PM | #4 |
Addict
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
You may wish to try my plugin that wraps images in SVG code. It is available at:
https://www.mobileread.com/forums/sh...d.php?t=283333 |
05-17-2017, 11:56 PM | #5 | |
Connoisseur
Posts: 60
Karma: 602194
Join Date: Apr 2017
Device: Ipad
|
Quote:
Then, when I select one of my svg images 'Select image window' I get a popup saying, "You must select an image from the list, or load a file." Last edited by Cyberseeker; 05-18-2017 at 12:08 AM. |
|
Advert | |
|
05-18-2017, 04:05 PM | #6 | ||
Addict
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
Quote:
Quote:
There is an issue with double clicking the selected file in the dialog box 'Choose an image file': if the mouse is double-clicked on an image filename in this dialog and the mouse is over the 'Select image' listbox of the ''Insert Image into ebook with SVG wrapping' window then the second click seems to go through to the listbox; if the listbox in this region is empty, then a file is not selected and you get the message "You must select an image from the list, or load a file.". To overcome this problem, instead of double clicking an image file to select it in the 'Choose an image file' dialog, click the image file once to highlight it and then click the 'Open' button in this dialog and this should open your image. I have not been able to resolve this issue so far; I may have to change the code so that a single click opens the image file, but I would prefer to find an alternative solution as a double click is the standard way to open a file. I hope the above helps in the meantime. |
||
05-18-2017, 04:17 PM | #7 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
That is a shame, since svg is a perfectly acceptable format for images in an ePUB.
|
05-18-2017, 05:29 PM | #8 | |
Connoisseur
Posts: 60
Karma: 602194
Join Date: Apr 2017
Device: Ipad
|
Quote:
|
|
05-18-2017, 06:09 PM | #9 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
No, but it will scale to any screen resolution utilizing the whole screen. When set correctly, it keep the aspect ratio.
|
05-18-2017, 08:31 PM | #10 |
Connoisseur
Posts: 60
Karma: 602194
Join Date: Apr 2017
Device: Ipad
|
Scaling to any screen resolution sounds like a good idea. But as I understand it, pixel based images degrade when scaled, whereas svg images do not. Is this an issue with CalibUser's plugin?
|
05-18-2017, 10:59 PM | #11 |
A Hairy Wizard
Posts: 3,222
Karma: 19000635
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
|
You can also manually import the svg file, then use the same technique, and code, to put the SVG wrapper around it. See the other thread you had on this topic.
|
05-19-2017, 03:21 PM | #12 |
Addict
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
The plugin imports images that use standard formats, eg png, and scales them to the size of the display screen for the ePub reader (retaining the aspect ratio), so if the original size of the image is significantly different to the height/width of the displayed image then some degradation is possible.
|
05-19-2017, 04:59 PM | #13 | |
Connoisseur
Posts: 60
Karma: 602194
Join Date: Apr 2017
Device: Ipad
|
Quote:
Last edited by Cyberseeker; 05-19-2017 at 05:06 PM. |
|
05-21-2017, 10:24 AM | #14 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
PIL/Pillow doesn't support SVG. But an SVG file is just XML, so it wouldn't be impossible to "detect" an SVG file using lxml or gumbo and extract its dimensions/viewPort. You'd have to intercept the SVG before passing the image data to PIL, but it would be possible to support SVG images with the Image Wrapper plugin. What doesn't pass the SVG sniff test could then be passed on to Pillow. Just a suggestion, mind you.
|
05-23-2017, 03:29 PM | #15 | |
Addict
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
Quote:
|
|
Tags |
image, svg, width |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Maximize Image Width | Cyberseeker | ePub | 19 | 06-07-2017 03:53 PM |
fit a image to the width of screen | leescott | ePub | 7 | 07-23-2015 11:39 AM |
Changing image width in the economist | goios | Recipes | 1 | 04-24-2014 02:29 PM |
problem with floating image and relative width | jobalcaen | ePub | 5 | 08-17-2013 08:53 AM |
Setting Image width on news feed | Wiggles | Calibre | 2 | 08-13-2010 03:10 AM |