Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 10-11-2024, 06:10 AM   #1
Acopdegarrotix
Junior Member
Acopdegarrotix began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2013
Device: Kobo Glo HD, Kobo Sage
kepub epub3. Avoiding blank spaces caused by images

In order to avoid blank spaces when images are pushed to next page (kePub ePub3), I've tried to use code based on RbnJrg's suggestion, and it worked beautifully in Calibre's viewer.

Quote:
Originally Posted by RbnJrg View Post
Yes, is what I said in my previous post. Watch the images I included there, and how the text moves when the font size is changed to avoid blank spaces. With epub3 the fragmentation is completely avoided. Use something like this:

Code:
  <figure>
    <img src="../Images/Your_image.jpg" alt="" style="width:100%"/>

    <figcaption>Fig.1 - Blah, blah, blah</figcaption>
  </figure>
and

Code:
figure {
  float: left;
  margin: 1em 0;
  padding: 4px;
  -webkit-column-break-inside: avoid !important; /* for webkit ereaders */
  break-inside: avoid !important;  /* for the rest of ereaders */
}

figcaption {
  font-style: italic; /* if you wish */
  padding: 2px; /* set here the measure you wish */
  text-align: center; 
}
However, all my attempts to have it working on my Kobo Sage have failed utterly, so I'm wondering whether I'm making some sort of mistake or it is simply that Kobos don't honor this code.

Here's the code I'm using.

In the CSS:
Code:
figure {
  margin: 1em 0;
  padding: 0;
  box-sizing: border-box;
  border: 0;
  display: inline-block !important;
  float: left !important;
  width: 100%;
  text-align: center;
  -webkit-column-break-inside: avoid !important;
  -webkit-page-break-inside: avoid !important;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

img {
  max-width: 80%;
  max-height: 80vh;
}
And in the xhtml:
Code:
  <figure>
    <img alt="" src="../Images/colour_01a.jpg"/>
  </figure>
Many thanks in advance to you all for your help.

Ernest
Acopdegarrotix is offline   Reply With Quote
Old 10-11-2024, 09:57 AM   #2
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 796
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Have you tried margin: 0; instead of margin: 1em 0;?
icallaci is offline   Reply With Quote
Advert
Old 10-11-2024, 04:47 PM   #3
Acopdegarrotix
Junior Member
Acopdegarrotix began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2013
Device: Kobo Glo HD, Kobo Sage
Hi, Icallaci.

Yes, I did. No joy, though. The only difference is that the text sits closer to the image.

I've attached screens from Calibre (left) and Kobo (right).
Attached Thumbnails
Click image for larger version

Name:	Calibre screen.png
Views:	56
Size:	756.2 KB
ID:	211353   Click image for larger version

Name:	Kobo screenshot.png
Views:	60
Size:	527.7 KB
ID:	211354  
Acopdegarrotix is offline   Reply With Quote
Old 10-11-2024, 08:38 PM   #4
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 796
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
Yeah, it looks like there's not enough room to fit the image on the page under the text, so Kobo moves it to the next page where it does fit. Does the same thing happen in the Calibre viewer? For example, in your screenshots, Calibre shows a full page of text on the left, then the image at the top of a new page, while the Kobo shows a partial page of text on the left, so there is no room for the image on the same page. If you fiddle with the font size in Calibre to show a partial page of text before the image is shown, does Calibre also force the image to the next page? I believe Kobo uses paged mode exclusively, while the Calibre viewer offers either paged mode or flow mode (Preferences/Page Layout). Flow mode in Calibre will scroll images, while paged mode will behave similarly to the Kobo. None of this is very helpful to actually fixing the problem, so maybe someone else with more expertise than I have can jump in here and offer some suggestions.
icallaci is offline   Reply With Quote
Old 10-11-2024, 09:01 PM   #5
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,436
Karma: 16297052
Join Date: Sep 2022
Device: Kobo Libra 2
I'm not sure this can be called a problem. If there isn't enough room to fit the image on the page, the image will get bumped to the next page. In the screenshot, there are six lines of text below the image, and the previous page has seven lines of text, so it would seem that WebKit wants no more than six lines of text at that font size in order to decide that the image will fit.

How many blank lines do you consider to be too many? You've set the image width to 100%, so you would probably need to allow the image to shrink if you want it to still appear on pages with more than six lines of text, i.e. you can't have both 100% width and also more than six lines of text on the page.
Aleron Ives is offline   Reply With Quote
Advert
Old 10-12-2024, 10:49 AM   #6
Acopdegarrotix
Junior Member
Acopdegarrotix began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2013
Device: Kobo Glo HD, Kobo Sage
Quote:
Originally Posted by icallaci View Post
If you fiddle with the font size in Calibre to show a partial page of text before the image is shown, does Calibre also force the image to the next page? I believe Kobo uses paged mode exclusively, while the Calibre viewer offers either paged mode or flow mode (Preferences/Page Layout). Flow mode in Calibre will scroll images, while paged mode will behave similarly to the Kobo.
Yes, I have Calibre set in page mode and, indeed, changing the font size doesn't affect the way it shows images.
Acopdegarrotix is offline   Reply With Quote
Old 10-12-2024, 11:30 AM   #7
Acopdegarrotix
Junior Member
Acopdegarrotix began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2013
Device: Kobo Glo HD, Kobo Sage
Quote:
Originally Posted by Aleron Ives View Post
I'm not sure this can be called a problem. If there isn't enough room to fit the image on the page, the image will get bumped to the next page. In the screenshot, there are six lines of text below the image, and the previous page has seven lines of text, so it would seem that WebKit wants no more than six lines of text at that font size in order to decide that the image will fit.

How many blank lines do you consider to be too many? You've set the image width to 100%, so you would probably need to allow the image to shrink if you want it to still appear on pages with more than six lines of text, i.e. you can't have both 100% width and also more than six lines of text on the page.
You're absolutely correct, of course. For epub2, both Calibre and Kobo push the image to the next page when they can't find room enough for it and leave a nice blank space behind.

For epub3, though, Calibre still pushes the image, but pulls up text from after the image to fill up the blank, whereas Kobo does not. Of course, with shrunken images the issue is minimized because it occurs less frequently, but it's not completely eliminated.
Attached Thumbnails
Click image for larger version

Name:	epub3 image at 100%.png
Views:	35
Size:	359.1 KB
ID:	211370   Click image for larger version

Name:	epub2 image at 100%.png
Views:	29
Size:	292.2 KB
ID:	211371   Click image for larger version

Name:	epub3 image at 50%.png
Views:	29
Size:	305.0 KB
ID:	211372   Click image for larger version

Name:	epub2 image at 50%.png
Views:	32
Size:	318.9 KB
ID:	211373   Click image for larger version

Name:	Screen from Kobo - kepub epub3 image at 50%.png
Views:	32
Size:	765.0 KB
ID:	211374  
Acopdegarrotix is offline   Reply With Quote
Old 10-12-2024, 05:56 PM   #8
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,436
Karma: 16297052
Join Date: Sep 2022
Device: Kobo Libra 2
Quote:
Originally Posted by Acopdegarrotix View Post
For epub3, though, Calibre still pushes the image, but pulls up text from after the image to fill up the blank, whereas Kobo does not.
That sounds like incorrect behaviour from Calibre to me. If the image is supposed to appear at a particular point in the story, the reading engine should not move the text around the image, which would cause the image to appear in a different place.
Aleron Ives is offline   Reply With Quote
Old 10-13-2024, 10:40 AM   #9
Acopdegarrotix
Junior Member
Acopdegarrotix began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2013
Device: Kobo Glo HD, Kobo Sage
Well, it would seem that I'm out of luck, then.

Anyway, thank you all very much for your help!
Acopdegarrotix is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't remove blank spaces between paragraphs Waylander Conversion 8 04-16-2024 12:38 PM
Missing spaces after coverting epub to kepub nyamok gajah Kobo Reader 11 01-11-2021 07:38 AM
kepub, EPUB3 and events fbrzvnrnd ePub 8 01-10-2017 03:43 AM
How to remove blank spaces? Mamaijee Conversion 2 04-09-2013 12:20 PM
Missing blank spaces in ToC richough3 ePub 3 09-10-2009 06:33 PM


All times are GMT -4. The time now is 01:57 AM.


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