View Single Post
Old 04-15-2016, 10:11 PM   #30
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by bentleymaniac View Post
1) what image format is best for epubs (jpg, png, svg, etc)
Depends on what the content of the image is.

If the image is realistic, like a "picture" or a "photograph", then JPG is probably your best bet.

If the image is computer-generated, text, or a handful of colors, like a Table/Graph/Chart/Formula/Screenshot/Line Drawing, then PNG is probably your best bet.

I always point back to my post about optimizing image size:

https://www.mobileread.com/forums/sho...45#post2499645

I have a sample of a chart there saved in JPG + varying PNGs.

Quote:
Originally Posted by bentleymaniac View Post
What I'm really trying to do is have the image float slightly, so that it displays full screen (on every device) at the next page turn after a particular referenced point in the text. So, for instance, you have the description of an event happening, and the next page turn gives you the illustration full screen, then the next page turn back to text WITHOUT having three quarters of the page before the illustration blank because the image is forced in a particular spot in the text.
What you are explaining here isn't possible in EPUB. Your best bet is to just stick the image in a logical position between two paragraphs.

Side Note: I deal with this problem all the time when digitizing PDFs. In physical books, typically Tables/Figures are "floated" to the top/bottom/middle/next page for typography reasons.

Back in 2014 I posted an example with orange boxes highlighting the area:

PDF: https://www.mobileread.com/forums/att...8&d=1392797612
EPUB: https://www.mobileread.com/forums/att...9&d=1392797612

In that case, I just inserted the Fig. 1 directly after the full paragraph. If the Figure is relevant to a specific paragraph on the page before, then in the EPUB you might try to insert the image directly after the paragraph it is referenced in.

Quote:
Originally Posted by bentleymaniac View Post
so it seems the code needs to make changes depending on the aspect ratio of the screen. so, if the screen is of a wider moving to landscape orientation, then do this, but if a skinny portrait, then do that.

I doubt this would be possible in css, but the next best thing would be to lock it into displaying at a set aspect ratio in portrait, so that there is no chance of the screen shape changing. If you know the screen's aspect ratio, you should be able to set width and height dimensions depending on the ratio of the image.
An SVG Wrapper already handles portrait/landscape and resizing the image while maintaining the proper ratio (just like it does for the SVG Covers).

Using the CSS Method, you run the chance of getting "oompa loompas" (the image gets stretched too wide), or a part of the image may run off the edge of the screen (think skinny/tall image on a cell phone that is landscape). As was explained previously (and in many other threads on this same topic), the way "height" is computed is not what you expect.

Quote:
Originally Posted by bentleymaniac View Post
I'm also completely illiterate in svg, but I think that setting the display's aspect ratio would allow me to use css for the images.
So if you take a look at the SVG Cover code that Sigil generates, you just have to substitute the X/Y values for each specific image.

Let us take your Image_01 for example. It is 499x767 pixels.

Quote:
<div style="text-align: center; padding: 0pt; margin: 0pt;">
<svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 499 767" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink">
<image width="499" height="767" xlink:href="../Images/Image_03.png"/>
</svg>
</div>
The Red text is where your substitute in the specific width/height of your image.

The Blue text is where you point to your specific image.

Quote:
Originally Posted by bentleymaniac View Post
The epub is attached (still incomplete, of course)
Ouch... your PNGs are seriously bloated. You have some colored speckles all over the place (probably artifacts of the scanning process or if you got it from a color scan where they used cameras instead... or somewhere along the line someone saved it as a lossy format (JPG)).

Image_05 + Image_06 + Image_07 were the absolute worst.

If you zoom in really far into a "white" section of the image, you can see all of the light gray/yellow speckles.

Also, some colors can be introduced in some Anti-Aliasing algorithms. So an image that you think is grayscale is actually full of all different shades of colors.

Here is a super zoomed in image to show you the speckles + colors due to AA:

Click image for larger version

Name:	ZoomedInSpeckled.png
Views:	282
Size:	3.3 KB
ID:	147865

I was able to do some basic touchups to get rid of the speckles and the PNGs went from 2.08 MBs -> 493 KBs. Even more can be saved if you were to Index the images (I compressed them down to 308 KBs from Indexing the PNGs to 17 shades of gray).

The book seems to be under copyright still, so I can't upload the fixed versions.

There was a lot of discussion of cleaning up Black/White/Grayscale images (here are the last two I remember):

https://www.mobileread.com/forums/sho...d.php?t=225518
https://www.mobileread.com/forums/sho...d.php?t=262301

Everyone has their own methods to cleanup. I personally just use GIMP (and I don't do anything advanced like in the topics above).

Last edited by Tex2002ans; 04-15-2016 at 10:23 PM.
Tex2002ans is offline   Reply With Quote