12-15-2021, 07:29 AM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jul 2020
Device: none
|
Preserve aspect ratio for images in Calibre
I have converted my Word file to ePub in Calibre successfully, but when the new epub file is expanded or shrunk for various devices the images distort and do not maintain their aspect ratio. I fixed the cover, but I have jpeg images for each chapter heading and they squash down width wise to tall and skinny when the file is reduced in width for smaller devices. Could someone please provide some HTML code to keep the images at their correct aspect ration of 16:9 ?
Thanks |
12-21-2021, 03:09 PM | #2 |
Connoisseur
Posts: 59
Karma: 221034
Join Date: May 2021
Device: None
|
Use the svg image tag. I recently learned how to use this myself:
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="0 0 [HEIGHT WIDTH]" height="100%" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"> <image height="[HEIGHT]" width="[WIDTH]" xlink:href="../images/[IMAGE FILE HERE]"/> </svg> Input your image height and width in the [HEIGHT WIDTH] section. So if your image is 1920x1280, viewbox="0 0 1920 1280" and height="1920" width="1280". You can also adjust the height and width percentages to fill your size needs. If you want the image just 75%, just change the percentage in the svg tag. Note: svg does not work for every format or every reader, but it's a great format to use. |
12-21-2021, 03:35 PM | #3 |
Connoisseur
Posts: 59
Karma: 221034
Join Date: May 2021
Device: None
|
Sorry, quick correction: swap the height and width in the svg tag. It should be [WIDTH HEIGHT]. My apologies. I typed in backwards. So with my example, it should be viewBox="0 0 1280 1920".
Hope this helps! |
12-22-2021, 12:49 AM | #4 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jul 2020
Device: none
|
Thanks, Foozle. Very good advice!
|
Tags |
aspect ration, calibre, images |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fixed aspect ratio of Edit TOC in Calibre 4.23 | iceorfire95 | Editor | 6 | 09-28-2020 07:11 AM |
Images refuse to keep aspect ratio in pdf conversion | Louiscar | Conversion | 2 | 12-20-2018 05:58 PM |
Aspect Ratio: to preserve or not to preserve, that is the question | RadicalxEdward | General Discussions | 3 | 04-12-2015 09:45 PM |
How do I preserve cover aspect ration in Calibre GUI? | titani | Calibre | 2 | 08-06-2014 10:09 AM |
DOCX conversion of images to EPUB/Mobi: preserve aspect ratio? | tbrosz | Conversion | 3 | 03-31-2014 01:56 PM |