Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 05-23-2016, 11:55 AM   #1
jcsalomon
Zealot
jcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheese
 
jcsalomon's Avatar
 
Posts: 100
Karma: 1204
Join Date: Jun 2012
Device: Bookari (née Mantano Reader) on Android; Kindle Fire HD
Question Full-page illustrations

What are the current guidelines for images intended to be full-page illustrations?

Image position: The source document has the images float so they take up the page after their insertion point. I’m not finding any clues how to accomplish this in EPUB, and I’m rather suspecting it isn’t possible (and certainly not in MOBI/KF7 conversion), so how have folk here handled this? (Unless I get a better suggestion, I’m going to ask the author’s approval to move each of the images to the end of their respective chapters.)

Image color: The images are scanned gray-scale line-art. (I was originally given JPEGs (!), but I’ve since received PSD files.) I understand that gray-scale PNG is the best format for this, but should I leave it as black & gray on white, or convert to transparent? On one hand, for readers like myself who prefer to set the background color away from white, a transparent background would be cleaner; on the other hand, some users might have set a reverse color theme. On the gripping hand, perhaps some e-readers choke on transparent PNGs? I’ve never seen PNGs used with transparent backgrounds, and I’m wondering why.

Image resolution: The image resolution is ridiculously high: 5921×7008 in one case; and I’ve already seen some e-readers choke on that. (Besides, this will make the download file far bigger than it needs to be.) Is there a recommended resolution which will work on most EPUB readers while still displaying sharply on Kindles?

Code: Is there any reason to use the SVG wrapper I’ve seen some recommendations for? Is there any CSS I should look for beyond text-align: center; height: 100%;? (ETA: Kindlegen tells me that my initial CSS, which included max-height: 100%; max-width: 100%;, is not supported, so I’m looking for a more portable option.)

Last edited by jcsalomon; 05-23-2016 at 01:00 PM.
jcsalomon is offline   Reply With Quote
Old 05-23-2016, 01:22 PM   #2
jcsalomon
Zealot
jcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheese
 
jcsalomon's Avatar
 
Posts: 100
Karma: 1204
Join Date: Jun 2012
Device: Bookari (née Mantano Reader) on Android; Kindle Fire HD
Seems I have a partial answer to image transparency, at least. The release notes for Kindlegen version 2.5 build 0626-3a91e28 includes
Quote:
Improved transparent PNG conversion: Transparent PNG images (now converted to JPEG) will use white background. This originally used black background during conversion causing degraded reading experience.
So not only will the transparency not work, it will also trigger a PNG→JPEG conversion. (ETA: Experimentation shows that kindlegen actually converts to a GIF image, without transparency.)

Well, that was worth a try, anyhow; whether EPUB e-readers support transparency (and what happens when a white-on-black theme is applied) hardly matters if the primary audience won’t see it.

Last edited by jcsalomon; 05-23-2016 at 01:41 PM.
jcsalomon is offline   Reply With Quote
Old 05-23-2016, 07:48 PM   #3
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,610
Karma: 8399999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by jcsalomon View Post
What are the current guidelines for images intended to be full-page illustrations?

Image position: The source document has the images float so they take up the page after their insertion point. I’m not finding any clues how to accomplish this in EPUB, and I’m rather suspecting it isn’t possible (and certainly not in MOBI/KF7 conversion), so how have folk here handled this? (Unless I get a better suggestion, I’m going to ask the author’s approval to move each of the images to the end of their respective chapters.)

Image color: The images are scanned gray-scale line-art. (I was originally given JPEGs (!), but I’ve since received PSD files.) I understand that gray-scale PNG is the best format for this, but should I leave it as black & gray on white, or convert to transparent? On one hand, for readers like myself who prefer to set the background color away from white, a transparent background would be cleaner; on the other hand, some users might have set a reverse color theme. On the gripping hand, perhaps some e-readers choke on transparent PNGs? I’ve never seen PNGs used with transparent backgrounds, and I’m wondering why.

Image resolution: The image resolution is ridiculously high: 5921×7008 in one case; and I’ve already seen some e-readers choke on that. (Besides, this will make the download file far bigger than it needs to be.) Is there a recommended resolution which will work on most EPUB readers while still displaying sharply on Kindles?

Code: Is there any reason to use the SVG wrapper I’ve seen some recommendations for? Is there any CSS I should look for beyond text-align: center; height: 100%;? (ETA: Kindlegen tells me that my initial CSS, which included max-height: 100%; max-width: 100%;, is not supported, so I’m looking for a more portable option.)
If your images are black-white line-art, then the best alternative is to use svg images. With svg images you won't have to worry about resolutions (always will be optimal) and will be transparent. Can you post here one of your images?
RbnJrg is offline   Reply With Quote
Old 05-23-2016, 09:12 PM   #4
jcsalomon
Zealot
jcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheese
 
jcsalomon's Avatar
 
Posts: 100
Karma: 1204
Join Date: Jun 2012
Device: Bookari (née Mantano Reader) on Android; Kindle Fire HD
Quote:
Originally Posted by RbnJrg View Post
If your images are black-white line-art, then the best alternative is to use svg images.
Yes, but what I have is high-res scans cleaned up in Photoshop, not any vector format. Are you suggesting autotrace?
jcsalomon is offline   Reply With Quote
Old 05-24-2016, 11:44 AM   #5
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,610
Karma: 8399999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by jcsalomon View Post
Yes, but what I have is high-res scans cleaned up in Photoshop, not any vector format. Are you suggesting autotrace?
Yes, I am. With a clean scan, you can convert the image to svg with Photoshop or Inkscape.
RbnJrg is offline   Reply With Quote
Old 05-25-2016, 01:29 AM   #6
jcsalomon
Zealot
jcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheesejcsalomon can extract oil from cheese
 
jcsalomon's Avatar
 
Posts: 100
Karma: 1204
Join Date: Jun 2012
Device: Bookari (née Mantano Reader) on Android; Kindle Fire HD
Well, I’ve got something that works, anyhow…

Converting to SVG vector drawing is a no-go: maybe in the future, with another book, but right now it’s more work than seems worth it (also the images won’t appear on older Kindles).

I’ve got PNGs scaled down to a maximum size of 1200×1600 pixels, and with their internal resolution set to 300 dpi. I could probably have chosen 1080×1440 at 300 dpi, since no e-reader I know of has a higher resolution than the new Kindles, but it’s a difference of only a few kilobytes. I’ve also gotten conflicting suggestions on PNG vs. GIF, and searching this forum doesn’t yield anything that looks authoritative. PNG it is for now, unless I get a good reason to change.

As for the code, I think I’ve put something together that works. Following the suggestion in the thread E-Book Formats › ePub › Image size, I’m using @media inquiries to switch between the SVG wrapper and straight image inclusion. (If I’m told that max-width and max-height are better supported on EPUB-based readers than the SVG wrapper, I can add that back too.) The only trouble is that ADE (delenda est!) chokes on @media not, so I’m going with this:

Code:
/* Images */
.img {
    page-break-inside: avoid;
    text-indent: 0; padding: 0; margin: 0;
    text-align: center;
    clear: both;
}

/* Defaults: ADE chokes on @media not */
.kf8-epub-default { display: inline; }
.mobi-fallback { display: none; }

@media amzn-mobi {
    .kf8-epub-default { display: none; }
    .mobi-fallback { display: inline; }
}

@media amzn-kf8 {
    .kf8-epub-default { display: inline; }
    .mobi-fallback { display: none; }
}
and
Code:
  <div class="img">
    <div class="mobi-fallback">
      <img alt="Rachel’s steeplechaser" src="../Images/Steeplechaser.png"/>
    </div>
    <div class="kf8-epub-default">
      <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 1200 1440" preserveAspectRatio="xMidYMid meet"><image width="1200" height="1440" xlink:href="../Images/Steeplechaser.png"/></svg>
    </div>
  </div>
(Yes, the @media amzn-kf8 rule is redundant with the default rule. But I may want to change one or the other in some way, and this lets me remember that they’re distinct.)

The CSS is based on suggestions in the threadE-Book Formats › ePub › Images in Sigil (ePub), with some additions I’m too tired to experiment with removing again.

This at least works on the Kindle Previewer in all models and in ADE 2.0 on Windows. I still need to test it against some Android EPUB readers and get feedback regarding actual Kindles and Nooks. I hope this example of putting different suggestions together is useful to someone in the future.

Last edited by jcsalomon; 05-25-2016 at 09:59 AM.
jcsalomon is offline   Reply With Quote
Old 05-25-2016, 04:38 PM   #7
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,304
Karma: 12126963
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by jcsalomon View Post
I’ve also gotten conflicting suggestions on PNG vs. GIF, and searching this forum doesn’t yield anything that looks authoritative. PNG it is for now, unless I get a good reason to change.
PNG is the superior format, and it can do everything GIF can do better (besides animation... which doesn't apply in EPUBs).
  • Color
    • GIF: Up to 256 colors.
    • PNG: Millions of colors.
      • There is also Indexed PNGs (up to 256 colors), which encompasses the entirety of GIF.
  • Transparency
    • GIF: Either on/off (and hackish).
    • PNG: Has an entire Alpha channel (8-bit transparency).
  • Compression
    • GIF: None or LZW.
    • PNG: A multitude of different types of compression algorithms can be used.
      • As an example, in 2013 Google released the Zopfli compression algorithm, which compresses ~3-8% more than the previous best algorithms.
      • In almost all cases, the equivalent PNG will be smaller than the GIF. (GIF only wins in very tiny icon-sized images because of less overhead).

Quote:
Originally Posted by jcsalomon View Post
Seems I have a partial answer to image transparency, at least. The release notes for Kindlegen version 2.5 build 0626-3a91e28 includes

[...]

So not only will the transparency not work, it will also trigger a PNG→JPEG conversion. (ETA: Experimentation shows that kindlegen actually converts to a GIF image, without transparency.)
Hmmm, that is good to hear they at least convert it to GIF. Although GIF transparency =/= PNG transparency.

When I wrote my "Tutorial: Formulas to PNG", KindleGen still converted Transparent PNG -> JPG, which was just PREPOSTEROUS:

https://www.mobileread.com/forums/sho...d.php?t=223254

I haven't really tested it since then, and have been converting all transparent formulas -> white background beforehand. (It also compresses much better, and Indexed PNGs with transparency are... it depends [see the thread for the Kindle black box bug I ran into depending on the PNG compression tool]).

Quote:
Originally Posted by jcsalomon View Post
Image color: The images are scanned gray-scale line-art. [...] I understand that gray-scale PNG is the best format for this, but should I leave it as black & gray on white, or convert to transparent?
For those types of images, you could save them as Grayscale PNGs (lossless)... or I recommend converting them to Indexed PNG (lossy). You can lower the amount of grays to <=256 (see my Tutorial above).

Bug to watch out for: Depending on which PNG compression tools you use, you should probably avoid 2-bit (4 color) and 4-bit (16 color) PNGs as some devices have display bugs. See GrannyGrump's topic here:

https://www.mobileread.com/forums/sho...d.php?t=222916

I personally just settled on 17 color Indexed PNGs. But anywhere from 17-256 Indexed colors should be safe (since this forces it to be an 8-bit PNG).

Last edited by Tex2002ans; 05-25-2016 at 08:39 PM.
Tex2002ans is offline   Reply With Quote
Reply

Tags
illustration, image, image quality, transparency

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Full page images? niki_johnson8 Editor 5 01-31-2015 02:06 PM
Still on the same page after full page refresh HansTWN Kobo Reader 0 08-20-2013 01:41 AM
Seeing full page shirazfb Introduce Yourself 6 12-14-2011 06:36 PM
How do you handle double-page spread illustrations? graycyn Workshop 12 11-14-2011 03:44 AM
Full page images graywolf336 ePub 3 11-17-2010 03:05 PM


All times are GMT -4. The time now is 12:45 PM.


MobileRead.com is a privately owned, operated and funded community.