![]() |
#1 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Dec 2018
Device: Kobo Glo HD
|
![]()
For some reason Calibre isn't resizing my images when I convert a .docx to an epub format. All of the forums that I find say it will automatically resize, but I've tried .png .jpg and .svg versions of the same image and they haven't been resizing. Instead they appear off the page. This doesn't really help, considering the main problem-image is a map.
The images will resize on an iPhone, iPad and MacOS iBooks, but not a Kobo ereader, even though the output type is set to Kobo. My book is a novel with only black and white images and reflowable text. Help would be appreciated! |
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
Quote:
First of all don't set the output type to "Kobo", because this refers to the original ancient Kobo devices that had extremely low resolution screens. Instead use "Tablet" so that the image file doesn't get resized. Second, you will usually need to edit the CSS or HTML styles so that the image displays at the size you want. E.g. if you want a map to fill the avaliable screen (i.e. changing the aspect ratio to match the available screen) then use height:100%; width:100%; for the img object. Or if you want to display the image as large as will fit on the screen but retaining the original aspect ratio then use height:100%; width:auto; max-width:100%; for images with a taller aspect ratio than the screen, or height:auto; max-height:100%; width:100%; for images with a wider aspect ratio than the screen. Alternatively you can use <svg> styles to resize the image which gives more control than <img>. (If you don't care about the aspect ratio and the only problem is that the images are too big for the screen then you might get away with just adding img {max-height:100%; max-width:100%;} to the book's stylesheet.) |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Chalut o/
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 415
Karma: 145424
Join Date: Dec 2017
Device: Kobo
|
I asked more or less the same question
https://www.mobileread.com/forums/sh...d.php?t=313771 tldr: Try setting the output profile to tablet. It's work. |
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Dec 2018
Device: Kobo Glo HD
|
Thanks so much for the reply! It's my first self-published eBook and I'd like to get everything right.
I put the style code into Look at Feel > Styling: img {max-height:100%; max-width:100%;} I also put it into tablet export (so much nicer, thanks for that tip). However the image is still going off the page vertically. It seems to fit horizontally but not vertically now. It it maybe not possible to win both? |
![]() |
![]() |
![]() |
#5 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
Quote:
Here is a simple example of styles for a full-page image using <img>: stylesheet.css: Code:
body.full-page-image { margin:0; padding:0; } div.full-page-image { margin:0; padding:0; text-align:center; } img.full-page-tall { margin:0; padding:0; height:100%; width:auto; max-width:100%; } img.full-page-wide { margin:0; padding:0; height:auto; max-height:100%; width:100%; } img.full-page-stretch { margin:0; padding:0; height:100%; width:100%; } Code:
<?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Map</title> <link href="stylesheet.css" rel="stylesheet" type="text/css"/> </head> <body class="full-page-image"> <div class="full-page-image"> <img alt="Map" src="map.jpg" class="full-page-stretch"/> </div> </body> </html> |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Dec 2018
Device: Kobo Glo HD
|
Thank you very much for helping me figure out which direction to go! I'll focus on the epub rather than Calibre.
Thanks again! |
![]() |
![]() |
![]() |
#7 | ||
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Dec 2018
Device: Kobo Glo HD
|
Quote:
Quote:
![]() |
||
![]() |
![]() |
![]() |
#8 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38,483
Karma: 152905840
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Convert your single line showing the map: Code:
<p class="block_15" id="calibre_pb_3"><img src="images/Southern_Elabrium_map_eBook.jpeg" alt="Image" class="calibre6"/></p> Code:
<div class="full-page-image"> <p class="block_15" id="calibre_pb_3"><img src="images/Southern_Elabrium_map_eBook.jpeg" alt="Image" class="full-page-stretch"/></p> </div> Personally, I prefer to use an svg wrapper for full screen images. Code:
<style type="text/css"> @page {padding: 0pt; margin:0pt} body { text-align: center; padding:0pt; margin: 0pt; } </style> </head> <body class="nomargin"> <div class="svg_wrapper"> <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 1000 1500" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"><image height="1500" width="1000" xlink:href="../Images/cover.jpg"/></svg> </div> Code:
.nomargin { display : block; text-align : center; margin : 0 0 0 0; } .svg_wrapper { display : block; margin : 0 0 0 0; padding : 0 0 0 0; text-align : center; } Change the height/width in both places to match your image and it will be fitted to the full screen. And yes, the multiple margin and padding settings are redundant but they work around some oddities in epubs I've edited. |
|
![]() |
![]() |
![]() |
Tags |
calibre, converting, images, jpg, svg |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I stop Calibre from resizing cover images? | starrigger | Conversion | 10 | 05-05-2023 07:31 AM |
images format changing and resizing | gianni_1 | Editor | 14 | 09-07-2018 08:35 PM |
Glo prevent glo from resizing images ? | leftright | Kobo Reader | 6 | 05-15-2014 04:04 AM |
resizing in-line images | pdurrant | ePub | 12 | 08-16-2013 04:08 AM |
resizing images in recipes? | schuster | Recipes | 5 | 05-16-2011 11:10 AM |