View Single Post
Old 05-01-2013, 03:04 AM   #26
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 elibrarian View Post
Erm ... I just tried the imagemagick convert jpg to jpg, and the file grew from 721 KB (saved with Photoshops save-to-web) to 756 KB ...

Any explanations?
I would NOT recommend Imagemagick to your normal user. It is an extremely powerful image tool, and it does make assumptions about input data.

Your typical image does have lots of worthless metadata called EXIF data, which can be easily tossed out to save some space:

https://en.wikipedia.org/wiki/Exif

This is somewhat what the "Save Image for Web" does in many programs.

Quote:
Originally Posted by DaleDe View Post
Each time it is saved a new image is generated from the displayed view. It is not really a copy. It is fresh conversion of the displayed image.Dale
Not in every case. You can just strip EXIF data without effecting the actual image, but yes... in most cases (and when most people open in an image editing program/save again), this is what happens. Lossy formats should ONLY belong to the very end of the production chain, and never anywhere in between.

Quote:
Originally Posted by dgatwood View Post
Unless the original is a photo that is starting out as JPEG, don't do that. Always tell Photoshop or Illustrator or whatever to export a PNG or TIFF file so that you have a lossless starting point. Then convert to JPEG from there.
Indeed. Lossy formats should ALWAYS be a final step. Always try to keep it lossless all the way up until the last possible point.

Quote:
Originally Posted by Toxaris View Post
There actually is something like lossless jpeg. It generates huge files, but it does exist.
There are a few, like JPEG2000.... but they are very poorly supported (and no way that they would work in EPUBs).

Quote:
Originally Posted by dgatwood View Post
That said, it is probably better to just ship with a future-proof high resolution copy and let people with ancient, slow devices either upgrade their hardware or shrink the cover image themselves.
I would go with the mid-resolution image (works well on the older/weaker devices, works well on larger devices as well), and you could always have the source documents/offer something better elsewhere (like directly on your site). No need to bloat the EPUBs with some overly large image file/s (I hate those EPUBs with about 100 KBs of text, and a 1.5 MBs cover).

I usually keep the book covers as JPG. I shoot for is a MAX of ~300-400 KBs covers, with a 800x1200 resolution.

Hopefully the next ebook format will be able to handle SVG much better, so that a lot of computer generated images (charts/tables/graphs) can auto-scale.

Quote:
Originally Posted by dgatwood View Post
Using PNG avoids this, but then you have no real way to increase the compression; it is what it is.
The greatness about lossless encoding is that the compression parameters can be changed, and you still get the same exact output (just smaller file size).

There are multiple PNG compression programs out there, I personally use ScriptPNG (There is also OptiPNG, PNGCrush, etc. etc.). This allows easy, drag and drop the files onto the batch file:

http://css-ig.net/scriptpng

Also, if you wanted to go the lossy PNG route, you could do things like drop from 24-bit encoding to 8-bit.

I consider 800x1200 a "Mid-resolution" (works well on older devices I tested on, also works well/looks good on PC).

You could always offer the much higher quality resolution cover directly on your site, for those of us who want to hunt it down and replace it ourselves.

For B/W or Grayscale images though, I go PNG all the way. If it is something that is a few colors (such as a table/charts/graphs), I go with PNG. You can easily Index all the colors and make a VERY small file size (with much higher quality when compared to JPG).

In the future, if better lossless compression algorithms come out, you could always just recompress your images to get better filesize, with zero loss in quality.

Example: In February 2013, Google released the Zoplfi algorithm, which allows ~3-8% better PNG compression than previous algorithms:

http://googledevelopers.blogspot.com...th-zopfli.html

If I ever go back to fix up little typos, or make tiny changes to the EPUB, I make sure to recompress the PNG images in the books I previously worked on, and am able to save a lot more space (for example, this book that I just fixed a few nights ago, I saved ~42 KBs from recompression).

Here is a sample Chart of different compressions I attached.

#1: GIMP, saved as "85 quality" JPG.

(LOSSLESS)
#2: GIMP, saved as PNG (max compression)
#3: Image #2 through ScriptPNG (~31% smaller)

(LOSSY)
#4: GIMP, saved as Indexed PNG (256 colors)
#5: Image #4 thorugh ScriptPNG (~11% smaller)

The JPG is ~130 KBs while the Indexed/ScriptPNG is 44.5 KBs (and looks WAY cleaner). You can really tell if you super zoom in on the solid color bars. In JPG, you can see the artifacting with different shades of red/blue/yellow, instead of being one solid color.
Attached Thumbnails
Click image for larger version

Name:	[GIMP][85]Ravier_Lewin_Fig7.jpg
Views:	525
Size:	130.6 KB
ID:	105196   Click image for larger version

Name:	[RGB]Ravier_Lewin_Fig7.png
Views:	492
Size:	143.1 KB
ID:	105197   Click image for larger version

Name:	[RGB][ScriptPNG]Ravier_Lewin_Fig7.png
Views:	469
Size:	98.8 KB
ID:	105198   Click image for larger version

Name:	[Indexed256]Ravier_Lewin_Fig7.png
Views:	505
Size:	50.0 KB
ID:	105199   Click image for larger version

Name:	[Indexed256][ScriptPNG]Ravier_Lewin_Fig7.png
Views:	499
Size:	44.5 KB
ID:	105200  

Last edited by Tex2002ans; 05-01-2013 at 03:11 AM.
Tex2002ans is offline   Reply With Quote