![]() |
#1 |
Member
![]() Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
|
Image upscale
I've been looking for a solution for this with no luck…
I have a Physics book filled with images containing lots of formulas and symbols in rather poor quality. I've used an upscaling software, and the results are surprisingly good. The problem is that the formulas now appear at 4 times the original size, and it's quite annoying. Is there a way for Sigil to include the original image size in the code so that once the images are replaced, they occupy the same container? I hope I have explained myself well ![]() Thank you very much in advance! |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,019
Karma: 190776330
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
If the images are sized via css in the epub, replacing the images will not change how they display. If they were not sized via css in the epub, there is no magic pill that I know of that will fix it. The only thing I know to do is to make note of the dimensions of the original images and then add css that will constrain the new ones to that size.
No doubt someone will come along shortly with a better solution. ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 145
Karma: 474196
Join Date: Jan 2011
Location: Ottawa
Device: Kobo Aura H2O
|
Closest I could suggest would be to add a class/style to all of your images to clamp them to the screen's dimensions, so they don't spill outside the page. I often use something like:
Code:
img { width:100%; max-height:100%; object-fit:contain; } |
![]() |
![]() |
![]() |
#4 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,890
Karma: 18274621
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
|
I use something similar. I’ll set the % of the screen I want to use but also limit the maximum to roughly the size of the images dimension. This helps a lot to prevent over-expanding the image and making it fuzzy.
Code:
CSS: img {max-height:100%; max-width:100%} div.image {width:50%; margin:1em auto} div.image img {max-width:600px} HTML: <div class="image"><img alt="" src="../Images/test.jpg"/></div> **set to the actual dimension of the image. |
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
|
Thanks a lot for the answers. The solution of giving all images a fixed 100% or less size won't do the trick. Some images are too small for that, IMO.
Looks a little overkill think ![]() ![]() There are more than a thousand images, so adding the sizes manually for all of them is out of the question. Maybe I can find some kind of script that parses the dimensions of all images and then doing some kind of find/replace ![]() Last edited by Elvys; 09-13-2023 at 02:38 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,309
Karma: 131560569
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
I would suggest something like using a style to set the image size relatively close to the text size. Change the height to get your best match.
Something like: Code:
.formula { height: 1.5em; width: auto; } <img alt="formula name" class="formula" src="../Images/formula002.jpeg"> I suspect that Regex will be your best friend for this task. |
![]() |
![]() |
![]() |
#7 | |
Member
![]() Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
|
Quote:
|
|
![]() |
![]() |
![]() |
#8 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 71,903
Karma: 122094787
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#9 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,309
Karma: 131560569
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
|
![]() |
![]() |
![]() |
#10 |
Member
![]() Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
|
|
![]() |
![]() |
![]() |
#11 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 71,903
Karma: 122094787
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#12 |
Member
![]() Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
|
|
![]() |
![]() |
![]() |
#13 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 71,903
Karma: 122094787
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#14 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,309
Karma: 131560569
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Probably but will it be less work than breaking the formulas into 1 line/2 line/etc though the example you gave of kg-m/s2 could easily be expressed as kg-m/s<superscript 2>.
|
![]() |
![]() |
![]() |
#15 | |
Member
![]() Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
|
Quote:
![]() Too much work to do manually. It would be faster to enter the size of each one ![]() |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Show info about the image in popup window of image viewer when reading an ebook | codychan | Calibre | 2 | 06-04-2021 05:04 PM |
Error message: Invalid image: cannot identify image file <_io.BytesIO object at 0x000 | bkleine | Calibre | 0 | 12-11-2020 04:39 PM |
Can I get metadata from cover image? The image is correct but all other data is wrong | mydjtl | Library Management | 1 | 12-14-2017 05:15 PM |
Display of a png image linked to a svg image | roger64 | Editor | 6 | 03-13-2015 06:21 AM |
Image on click change to nex image for Ipad view. | vinayaksanga | ePub | 9 | 04-29-2013 06:49 AM |