04-14-2016, 05:13 AM | #16 | |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
Quote:
I edited your code a bit and deleted some stuff. try Code:
div.inline { page-break-inside:avoid; text-align:center; } div.inline img { max-height:100%; width:100%; max-width:100%; } |
|
04-14-2016, 05:51 AM | #17 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
What does max-width:100% do that width:100% doesn't?
Keeps it from running off the "page," I suppose, but why would it do that? |
Advert | |
|
04-14-2016, 07:48 AM | #18 | |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
Quote:
max-width/height are limits, which the picture must not exceed. width: 100% sets the picture to the maximum size within these limits. Consider, that there are 4 modes of viewing: - the picture could be in a landscape or a portrait-shape. - the user could have his device in portrait oder landscape-mode the css should be fine for all 4 . |
|
04-14-2016, 08:21 AM | #19 | |
Fanatic
Posts: 554
Karma: 400004
Join Date: Feb 2009
Device: ONYX M96
|
Quote:
No, with your CSS, a high image, higher than wide, would end up off the page. |
|
04-14-2016, 09:36 AM | #20 | |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
Quote:
However, there may be some devices, which mess this up, thats not my fault... |
|
Advert | |
|
04-14-2016, 09:48 AM | #21 |
Fanatic
Posts: 554
Karma: 400004
Join Date: Feb 2009
Device: ONYX M96
|
Actually Adobe Digital Edition override the max-height rule with the width one. So, every ebook reader based on Adobe Digital Mobile.
|
04-14-2016, 09:53 AM | #22 |
Fanatic
Posts: 554
Karma: 400004
Join Date: Feb 2009
Device: ONYX M96
|
|
04-14-2016, 12:25 PM | #23 |
A Hairy Wizard
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
It would really be convenient if there was a "page-height/width" or "screen-height/width" to use in CSS....maybe it'll make it into CSS4???
In the meantime, If I need the image to fill the screen, I just wrap it in SVG. If the device/app you are coding for doesn't support SVG in anything but the cover, then I'd ditch the app...lol....or just have individualized css for images that are wider than tall, and those that are higher than wide. Code:
div.inline {text-indent:0; text-align:center; margin:.25em auto; page-break-inside:avoid} div.tall {line-height:5} div.wide {width:100%} img {max-width:100%; max-height:100%} div.wide img {width:100%} div.tall img {height:100%} <div class="inline wide"><img alt="" src="../Images/pic.jpg" /></div> <div class="inline tall"><img alt="" src="../Images/pic.jpg" /></div> Code:
<div class="inline tall" style="line-height:3em"> |
04-15-2016, 03:09 AM | #24 | |
Fanatic
Posts: 554
Karma: 400004
Join Date: Feb 2009
Device: ONYX M96
|
Quote:
|
|
04-15-2016, 03:10 PM | #25 | |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
Quote:
I agree, that max-height/width don't work as had I expected. (Hell, it would be too easy). So the easiest solution for the Problem of the OP is to set height/width to 100% separately for each picture according to it's aspect ratio and orientation. |
|
04-15-2016, 03:58 PM | #26 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
|
04-15-2016, 04:40 PM | #27 |
Fanatic
Posts: 554
Karma: 400004
Join Date: Feb 2009
Device: ONYX M96
|
The real question is: why IDPF still makes us working with WEB tools instead ebook ones?
|
04-15-2016, 07:37 PM | #28 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Oct 2015
Device: kobo
|
so it seems the code needs to make changes depending on the aspect ratio of the screen. so, if the screen is of a wider moving to landscape orientation, then do this, but if a skinny portrait, then do that.
I doubt this would be possible in css, but the next best thing would be to lock it into displaying at a set aspect ratio in portrait, so that there is no chance of the screen shape changing. If you know the screen's aspect ratio, you should be able to set width and height dimensions depending on the ratio of the image. Problem is, I'm only new to ebook editing and creation, so have no idea how to do that. I'm also completely illiterate in svg, but I think that setting the display's aspect ratio would allow me to use css for the images. I think that there would be less danger of setting width=100% if you could be certain of the screen's aspect ratio. (I'm guessing this is needed more for computers and phones/tablets than eInk readers) |
04-15-2016, 08:48 PM | #29 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Oct 2015
Device: kobo
|
so, I've gone through and changed html for each image depending on the aspect ratio, in the form
Code:
<img style="height:100% width:auto" alt="Image_03" src="../Images/Image_03.png"/> Code:
<img style="height:auto width:100%" alt="Image_03" src="../Images/Image_03.png"/> Also, ADE and Kobo are not displaying my embedded fonts (I think I have a coding error there). Any help would be much appreciated. The epub is attached (still incomplete, of course)untitled.epub Last edited by bentleymaniac; 04-15-2016 at 09:28 PM. |
04-15-2016, 10:11 PM | #30 | |||||
Wizard
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
If the image is realistic, like a "picture" or a "photograph", then JPG is probably your best bet. If the image is computer-generated, text, or a handful of colors, like a Table/Graph/Chart/Formula/Screenshot/Line Drawing, then PNG is probably your best bet. I always point back to my post about optimizing image size: https://www.mobileread.com/forums/sho...45#post2499645 I have a sample of a chart there saved in JPG + varying PNGs. Quote:
Side Note: I deal with this problem all the time when digitizing PDFs. In physical books, typically Tables/Figures are "floated" to the top/bottom/middle/next page for typography reasons. Back in 2014 I posted an example with orange boxes highlighting the area: PDF: https://www.mobileread.com/forums/att...8&d=1392797612 EPUB: https://www.mobileread.com/forums/att...9&d=1392797612 In that case, I just inserted the Fig. 1 directly after the full paragraph. If the Figure is relevant to a specific paragraph on the page before, then in the EPUB you might try to insert the image directly after the paragraph it is referenced in. Quote:
Using the CSS Method, you run the chance of getting "oompa loompas" (the image gets stretched too wide), or a part of the image may run off the edge of the screen (think skinny/tall image on a cell phone that is landscape). As was explained previously (and in many other threads on this same topic), the way "height" is computed is not what you expect. Quote:
Let us take your Image_01 for example. It is 499x767 pixels. Quote:
The Blue text is where you point to your specific image. Ouch... your PNGs are seriously bloated. You have some colored speckles all over the place (probably artifacts of the scanning process or if you got it from a color scan where they used cameras instead... or somewhere along the line someone saved it as a lossy format (JPG)). Image_05 + Image_06 + Image_07 were the absolute worst. If you zoom in really far into a "white" section of the image, you can see all of the light gray/yellow speckles. Also, some colors can be introduced in some Anti-Aliasing algorithms. So an image that you think is grayscale is actually full of all different shades of colors. Here is a super zoomed in image to show you the speckles + colors due to AA: I was able to do some basic touchups to get rid of the speckles and the PNGs went from 2.08 MBs -> 493 KBs. Even more can be saved if you were to Index the images (I compressed them down to 308 KBs from Indexing the PNGs to 17 shades of gray). The book seems to be under copyright still, so I can't upload the fixed versions. There was a lot of discussion of cleaning up Black/White/Grayscale images (here are the last two I remember): https://www.mobileread.com/forums/sho...d.php?t=225518 https://www.mobileread.com/forums/sho...d.php?t=262301 Everyone has their own methods to cleanup. I personally just use GIMP (and I don't do anything advanced like in the topics above). Last edited by Tex2002ans; 04-15-2016 at 10:23 PM. |
|||||
Tags |
epub 3, help needed, sigil |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Images now showing in ePub after editing in Sigil or Calibre | postkast2929 | ePub | 44 | 04-21-2016 11:45 AM |
Can I use the code Sigil uses for Covers for other images? | rosshalde | Sigil | 4 | 12-23-2014 11:00 AM |
Copying Sigil Images Folder | EditorOne | Sigil | 5 | 06-08-2013 08:50 PM |
Images with Sigil | Gerlyn | ePub | 2 | 02-08-2012 01:05 PM |
Alreader not showing images after editing ePUB with Sigil | cerramadre | Sigil | 27 | 09-02-2011 10:24 PM |