Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-13-2023, 07:29 AM   #1
Elvys
Member
Elvys began at the beginning.
 
Elvys's Avatar
 
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!
Elvys is offline   Reply With Quote
Old 09-13-2023, 07:59 AM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,595
Karma: 193191846
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.
DiapDealer is offline   Reply With Quote
Advert
Old 09-13-2023, 10:48 AM   #3
Vanguard3000
Groupie
Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.
 
Posts: 152
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;
}
Sometimes I'll change the max height to 80% or so if you want to leave some room for a caption. But if you've got images that are floating left or right, varying widths and so forth and there's no existing styling, you may have to go through it manually and add a few of your own classes.
Vanguard3000 is offline   Reply With Quote
Old 09-13-2023, 11:02 AM   #4
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,119
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
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. 
Turtle91 is offline   Reply With Quote
Old 09-13-2023, 02:34 PM   #5
Elvys
Member
Elvys began at the beginning.
 
Elvys's Avatar
 
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.
Elvys is offline   Reply With Quote
Advert
Old 09-13-2023, 02:58 PM   #6
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,499
Karma: 145748888
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, 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;
}
And in the text files, use something similar to the following:

<img alt="formula name" class="formula" src="../Images/formula002.jpeg">

I suspect that Regex will be your best friend for this task.
DNSB is offline   Reply With Quote
Old 09-13-2023, 03:00 PM   #7
Elvys
Member
Elvys began at the beginning.
 
Elvys's Avatar
 
Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
Quote:
Originally Posted by DNSB View Post
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;
}
And in the text files, use something similar to the following:

<img alt="formula name" class="formula" src="../Images/formula002.jpeg">

I suspect that Regex will be your best friend for this task.
I'm afraid that wouldn't work either, some formulas are several lines height.
Elvys is offline   Reply With Quote
Old 09-13-2023, 03:00 PM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,537
Karma: 129670952
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Elvys View Post
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!
You could use one of the various math formula creators on the web that saves to SVG and go that route to replace the low-res images.
JSWolf is offline   Reply With Quote
Old 09-13-2023, 03:02 PM   #9
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,499
Karma: 145748888
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Elvys View Post
I'm afraid that wouldn't work either, some formulas are several lines height.
There is not going to be a magic one size fits all solution.
DNSB is offline   Reply With Quote
Old 09-13-2023, 03:04 PM   #10
Elvys
Member
Elvys began at the beginning.
 
Elvys's Avatar
 
Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
Quote:
Originally Posted by JSWolf View Post
You could use one of the various math formula creators on the web that saves to SVG and go that route to replace the low-res images.
More than a thousand formulas on the book. Too much work
Elvys is offline   Reply With Quote
Old 09-13-2023, 03:06 PM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,537
Karma: 129670952
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Elvys View Post
More than a thousand formulas on the book. Too much work
Return the eBook and buy the pBook version instead.
JSWolf is offline   Reply With Quote
Old 09-13-2023, 03:06 PM   #12
Elvys
Member
Elvys began at the beginning.
 
Elvys's Avatar
 
Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
Quote:
Originally Posted by DNSB View Post
There is not going to be a magic one size fits all solution.
Every image has metadata in it, including the size in pixels.
There must be a way to extract it…
Elvys is offline   Reply With Quote
Old 09-13-2023, 03:11 PM   #13
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,537
Karma: 129670952
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Elvys View Post
Every image has metadata in it, including the size in pixels.
There must be a way to extract it…
Not easily and not such that it would come out as the code you need for an ePub.
JSWolf is offline   Reply With Quote
Old 09-13-2023, 03:14 PM   #14
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,499
Karma: 145748888
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Elvys View Post
Every image has metadata in it, including the size in pixels.
There must be a way to extract it…
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>.
DNSB is offline   Reply With Quote
Old 09-13-2023, 03:27 PM   #15
Elvys
Member
Elvys began at the beginning.
 
Elvys's Avatar
 
Posts: 16
Karma: 10
Join Date: Sep 2021
Location: Spain
Device: Kobo Sage
Quote:
Originally Posted by DNSB View Post
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>.
There are more than a thousand formulas. Many look like this:



Too much work to do manually.
It would be faster to enter the size of each one
Elvys is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 12:37 AM.


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