Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 06-25-2013, 04:12 AM   #1
HC9
Junior Member
HC9 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2013
Device: Kobo & Sony
Post How to reduce size of image files?

Hi!
I am using Calibre.
I have in my library a lot of epub files larger than 300 ko.
Mainly, this is due to image files with inappropriate size (in pixel) or quality (jpeg level compression).
I would like to reduce file size (based on max image size and jpeg quality).
I do not want to do it manually one by one within epub zip file.
Do you have idea how to set-up caliber to help me in this mission?
May be an other tool ?
Thanks in advance to all of you.
HC9 is offline   Reply With Quote
Old 06-25-2013, 05:37 AM   #2
Adoby
Handy Elephant
Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.
 
Adoby's Avatar
 
Posts: 1,052
Karma: 3824376
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Ubuntu Linux, Cybook Opus, Motorola Xoom with Mantano Premium
The easiest way would most likely be to convert the books with an appropriate output profile. Calibre will then resize the images to fit on the device selected as output profile. Use a device with a small screen as output profile. Do some testing.

You convert epub to epub. I don't know if polish is enough? Might try it?

http://www.mobileread.com/forums/sho...d.php?t=191906
Adoby is offline   Reply With Quote
Old 06-25-2013, 07:44 AM   #3
HC9
Junior Member
HC9 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2013
Device: Kobo & Sony
Thanks for your quick advice.

I tried but it is not very optimized:
Small screen size = Microsoft Reader (seems to be)
Original image = 459 x 747 (161 KB)
New image after export = 392 x 638 (126 KB)

Manually,
Reduce jpeg quality compression by 50% without resize, new weigh is 55 KB!
HC9 is offline   Reply With Quote
Old 06-25-2013, 08:14 AM   #4
Adoby
Handy Elephant
Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.Adoby ought to be getting tired of karma fortunes by now.
 
Adoby's Avatar
 
Posts: 1,052
Karma: 3824376
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Ubuntu Linux, Cybook Opus, Motorola Xoom with Mantano Premium
To do that you would most likely have to hack the source code for calibre. Easier to do it manually as you just did...
Adoby is offline   Reply With Quote
Old 06-25-2013, 10:37 AM   #5
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 629
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
You might be able to find some bulk image editing or converter software that does what you want. No specific software comes to mind but someone might offer something that would automate the process a bit. I would suggest checking download sites and/or your favorite search engine.
Sabardeyn is offline   Reply With Quote
Old 06-25-2013, 10:46 AM   #6
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,770
Karma: 43931916
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
What I have done is to use the Tweak ePub to explode the book, then Irfanview to resize / resample all the images (with the option to place them back in the original locations), followed by letting Tweak ePub rebuild the book.

I've found this to be very useful especially when transferring cookbooks with massive, full colour images to an eReader.
PeterT is offline   Reply With Quote
Old 06-25-2013, 12:32 PM   #7
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,424
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
Hi

This Linux bash script let you bulk resize jpg images to a 600x800 pixels resolution. It creates a new folder named "reduced". It can be launched by a right click (nautilus-script or similar). It uses convert from Imagemagick.

If you wish a different resolution or apply it to a different image format, open the script and change the relevant information.

Spoiler:

#!/bin/bash


mkdir reduced
for FILE in *.jpg


do
convert "$FILE" -resize 600x800\> reduced/"$FILE"
done

echo "Terminé"
zenity --info --text "Terminé"

exit 0;
roger64 is offline   Reply With Quote
Old 06-25-2013, 06:18 PM   #8
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 3,415
Karma: 1957866
Join Date: Mar 2012
Location: NSW Australia
Device: none
The FastStone program - MaxView for Windows is an image viewer that reads ZIPs and RAR's - it can do simple jpeg edits such as rotates, flips, and resize with compression.

Its not freeware and it may not work on EPUBS - but it might be worth a try.

Oh, an EPUB file is a ZIP'd folder.

Addenda - I just had a brief play - Maxview doesn't have the facility replace the original image with the edited image within the archive, it must be saved elsewhere; and there are no bulk operations; and the development of product seems to have ceased, last update June 2011.

So its probably not suited to this task. I hadn't used its editing features previously.

Aaah, well its the thought that counts - Maxview is still a good viewer if like me you prefer to have image-sets in archives rather than individual files in individual folders.

BR

Last edited by BetterRed; 06-25-2013 at 07:25 PM. Reason: Addenda
BetterRed is offline   Reply With Quote
Old 06-25-2013, 07:11 PM   #9
PatNY
Zennist
PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.
 
PatNY's Avatar
 
Posts: 927
Karma: 46026034
Join Date: Jul 2010
Device: iPod Touch, Sony PRS-350, Nook HD+ & HD
I frequently "compact" epubs by compressing jpegs further and optimizing PNGs. Here's the fastest way I've found to do it:

1) Explode the epub using Calibre's tweak book feature.

2) Navigate to the images folder and select all. Drag and drop them onto the interface of Fotosizer, a free batch photo resizing program.

3) Set the compression level. I usually set it to 55 but you can go lower if you want even smaller files. Adjust the resize settings if you want. I usually keep all my images at their original resolution (default setting) as I'd prefer more compressed jpegs over lower-res photos.

4) Set the destination directory -- I just always use "same as original"

5) Click "Start" and in about a minute or less, all the images you selected will be resampled and compressed.

6) Rebuild the book.

You should now have a book that is significantly smaller than the original. On a 55 setting, I can get space savings of up to 70% or more.

If the images are PNGs, I use PngGauntlet. It is also free, and you also can just drag and drop your images onto the interface and batch process them. However, since optimizing PNGs takes far longer than resampling jpegs, the process can take up to an hour or more, depending on how many PNGs are in your book. Since I don't like to leave a book "exploded" in calibre for a long time, for PNGs I will just copy the originals onto a folder on my desktop. I then optimize them from there. When it's done, I just replace the originals in the exploded book with the optimized ones. The space savings with PNGs is not as great as you can get with jpegs. Maybe 10-20%.

--Pat

Last edited by PatNY; 06-25-2013 at 07:14 PM.
PatNY is offline   Reply With Quote
Old 06-26-2013, 05:19 AM   #10
HC9
Junior Member
HC9 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2013
Device: Kobo & Sony
Thanks all for your suggestions.

My main concern is to do that on all my epub files in one time and not one by one

I tried to explore the zip solution:
- I add a new extension (.zip) to all my epub files (one click with the right software)
- Now all epub files are seen as zip folder by Windows and I can navigate inside as if it is simple folder.

Next step is to find the way to resize pictures (batch mode) inside these “zip” folders.
I tried without success: Photoshop, ACD See, Faststone (MaxViewer, Viewer & Resize).

Next try with Fotosizer.
Any others ideas?

A simple question but no a so easy answer
HC9 is offline   Reply With Quote
Old 06-26-2013, 08:45 AM   #11
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 3,415
Karma: 1957866
Join Date: Mar 2012
Location: NSW Australia
Device: none
Quote:
Originally Posted by HC9 View Post
Thanks all for your suggestions.

My main concern is to do that on all my epub files in one time and not one by one

I tried to explore the zip solution:
- I add a new extension (.zip) to all my epub files (one click with the right software)
- Now all epub files are seen as zip folder by Windows and I can navigate inside as if it is simple folder.

Next step is to find the way to resize pictures (batch mode) inside these “zip” folders.
I tried without success: Photoshop, ACD See, Faststone (MaxViewer, Viewer & Resize).

Next try with Fotosizer.
Any others ideas?

A simple question but no a so easy answer
I don't think you'll find anything that will resize in situ within one ZIP let alone many, I think MaxView was your last best hope

Copy the epubs to a folder on your desktop eg EPUBRESIZE - unzip them into subfolders. Then use a script (see Roger64 post) that walks the EPUBRESIZE folder tree and does the resize and compression with the imagemagick convert command

Google will find imagemagick
FOR /R will walk a folder tree in a batch file

When convert is all done, create new ZIPs from the subfolders with the resized pictures, rename them to EPUB and put them back into their calibre folders.

Obviously backup the library first and test on a few books

BR
BetterRed is offline   Reply With Quote
Old 06-26-2013, 09:21 AM   #12
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,770
Karma: 43931916
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
Becareful with the rezipping; don't forget there are very special rules for the internal layout of the ePub file.
PeterT is offline   Reply With Quote
Old 06-26-2013, 11:38 AM   #13
PatNY
Zennist
PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.PatNY ought to be getting tired of karma fortunes by now.
 
PatNY's Avatar
 
Posts: 927
Karma: 46026034
Join Date: Jul 2010
Device: iPod Touch, Sony PRS-350, Nook HD+ & HD
Quote:
Originally Posted by PeterT View Post
Becareful with the rezipping; don't forget there are very special rules for the internal layout of the ePub file.
Good point. I remember, before Tweak Book was added to Calibre, I had problems with 1 or 2 books I had unzipped with a utility to make some changes. That's why I do things through Tweak Book in Calibre almost always. Or I use Sigil.

--Pat
PatNY is offline   Reply With Quote
Old 06-26-2013, 08:03 PM   #14
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 3,415
Karma: 1957866
Join Date: Mar 2012
Location: NSW Australia
Device: none
Quote:
Originally Posted by PeterT View Post
Becareful with the rezipping; don't forget there are very special rules for the internal layout of the ePub file.
I ran the suggested process on three books, one with no images, one with a few jpegs and another with about 30 jpegs and five pngs.

I did not change any files other than the images, nor any file names, I also retained the timestamps on the image files.

I used Winrar to unzip and rezip the folders - as far I can tell they're fine, as an extra test I converted the rezipped EPUBs to AZW and RTF, they work fine in Kindle for PC, MS Word and OOo Writer.

I'd be very wary of using the process on anything other than the image files, eg the HTML, or XML components. But in the context of an EPUB, images are binary blobs that don't in themselves reference any other EPUB components. So providing one is careful then the process should work.

A "Squeeze Images" plugin would be nice.

BR
BetterRed is offline   Reply With Quote
Old 06-26-2013, 08:19 PM   #15
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,770
Karma: 43931916
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
Quote:
Originally Posted by BetterRed View Post
A "Squeeze Images" plugin would be nice.

BR
You mean like this request?

Quote:
Originally Posted by PeterT View Post
A situation I often run into, especially with Cook Books, is the size of the images. Publishers seem to assume that you want to view the books either on a PC or a tablet with a high resolution, colour display, and this leads to the images in the ePubs being quite large (400 k and up).

What I tend to do is to use the Tweak function to explode the ePub, then Irfanview to re-sample all the images, retaining their dimensions but lowering their quality, and finally, letting the Tweak function rebuilt the ePub.

It would be far simpler if a plugin existed that could handle this, possibly with criteria to handle the selection of which images to re-sample, and maybe even the ability to convert images from colour to black and white.
PeterT is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best image size for cover? Alda ePub 1 03-20-2013 02:08 PM
How to reduce size of opf file??? karenbryant ePub 14 07-06-2012 03:59 AM
How do I reduce popup size for cover selection? lizzielou Calibre 2 05-06-2012 04:41 AM
18MB EPUB converts to 40MB Mobi! What can I do to reduce Mobi file size? perdman Conversion 7 08-27-2011 02:40 PM
Image Size benjaminsolah ePub 13 09-24-2010 11:47 PM


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


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