Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-17-2024, 11:49 AM   #1
karlfranz
Junior Member
karlfranz began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2024
Device: Boox Note Air 3 & 3C, KyBook 3 on iPad
Batch processing EPUB lossy compression

I was given several hundred EPUB files that are (needlessly) about 2-300MB in size. I find that I can use Calibre's pub editor to effectively compress each book by 80-90% by using lossy compression set to 60 while still remaining fully readable for my needs. However, it is quite tedious to individually:
  1. Open each file in the editor;
  2. Select "Tools|Compress images losslessly";
  3. Select the two "Enable Lossy Compression" checkboxes;;
  4. Click OK;
  5. Wait for compression to complete;
  6. Click Close on the compression results "Action Report" dialog box;
  7. Save the new compressed EPUB and close the editor.

Is there a plugin or action that would allow me to automate this so I can batch process all my files in one go?
karlfranz is offline   Reply With Quote
Old 06-17-2024, 12:19 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,445
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
That is already a choice of Polish
Select Books: Click the Polish icon: tick the options as desired: OK
theducks is offline   Reply With Quote
Advert
Old 06-17-2024, 12:31 PM   #3
karlfranz
Junior Member
karlfranz began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2024
Device: Boox Note Air 3 & 3C, KyBook 3 on iPad
Quote:
Originally Posted by theducks View Post
That is already a choice of Polish
Select Books: Click the Polish icon: tick the options as desired: OK
Polish doesn't seem to let me choose a level of lossy compression. I think it only does lossless compression which isn't very effective in reducing file size.
karlfranz is offline   Reply With Quote
Old 06-17-2024, 12:41 PM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,445
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Sorry, misread the request.
Bulk mode Metadata Edit has a spin wheel (Compress Images) near the bottom.
theducks is offline   Reply With Quote
Old 06-17-2024, 12:58 PM   #5
karlfranz
Junior Member
karlfranz began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2024
Device: Boox Note Air 3 & 3C, KyBook 3 on iPad
Quote:
Originally Posted by theducks View Post
Sorry, misread the request.
Bulk mode Metadata Edit has a spin wheel (Compress Images) near the bottom.
I'm confused. My Bulk Metadata Edit has a checkbox near the bottom of the "Basic Metadata" tab called "Compress cover images" along with a compression amount spinner. But it's only for the cover image, not all the images in the EPUB.
karlfranz is offline   Reply With Quote
Advert
Old 06-17-2024, 01:03 PM   #6
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: 76,432
Karma: 136564696
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 theducks View Post
Sorry, misread the request.
Bulk mode Metadata Edit has a spin wheel (Compress Images) near the bottom.
That won't work as it's only for compressing the cover.
JSWolf is online now   Reply With Quote
Old 06-17-2024, 01:08 PM   #7
karlfranz
Junior Member
karlfranz began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2024
Device: Boox Note Air 3 & 3C, KyBook 3 on iPad
Quote:
Originally Posted by JSWolf View Post
That won't work as it's only for compressing the cover.
Exactly.
karlfranz is offline   Reply With Quote
Old 06-17-2024, 09:39 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Do an EPUB to EPUB bulk conversion and in the epub output section specify a max resolution for the images.
kovidgoyal is offline   Reply With Quote
Old 06-18-2024, 09:38 AM   #9
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
A combination of Editor Chains and Action Chains lets you perform lossy compression on multiple books.

In Editor Chains, there is a an action called "Compress Images", that enables you to automate this process. You can use the Action Chains to run this for multiple books. (chain in first attachment).

If you want to use an external tool to for lossy compression, e.g. ImageMagick, which can help convert png to jpg, you can use the Run Command action which will iterate over all images in an epub. See this post and screenshots for more details. (chain in second attachment). Note however, that you might need to edit the chain to configure the path to ImageMagick on your system.

To import the attached chains: Action Chains > Add/Modify chains > right click the chains table > import > browse to the zip file.

Note: I have found the ImageMagick approach to be much faster with lossy compression compared to the first approach that uses the editor's "Compress Images". Test with both and see which is more satisfactory.
Attached Files
File Type: zip lossy1.zip (558 Bytes, 41 views)
File Type: zip lossy2.zip (714 Bytes, 46 views)

Last edited by capink; 06-18-2024 at 12:52 PM.
capink is offline   Reply With Quote
Old 06-18-2024, 10:54 AM   #10
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: 76,432
Karma: 136564696
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 capink View Post
A combination of Editor Chains and Action Chains lets you perform lossy compression on multiple books, by running ImageMagick commands on the images.

See this post and screenshots for more details.

For how to use both plugins together consult the first post in Editor Chains thread.
Is there a way to do a lossy lossless compression on the images? In the editor, it does the compress of 70 that I specified and then does a lossless compression from there.
JSWolf is online now   Reply With Quote
Old 06-18-2024, 12:47 PM   #11
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by JSWolf View Post
Is there a way to do a lossy lossless compression on the images? In the editor, it does the compress of 70 that I specified and then does a lossless compression from there.
It can replicate what the editor does by using the "Compress Images". I updated the post above with example chains.
capink is offline   Reply With Quote
Old 06-20-2024, 11:38 PM   #12
karlfranz
Junior Member
karlfranz began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jun 2024
Device: Boox Note Air 3 & 3C, KyBook 3 on iPad
Quote:
Originally Posted by capink View Post
A combination of Editor Chains and Action Chains lets you perform lossy compression on multiple books.

In Editor Chains, there is a an action called "Compress Images", that enables you to automate this process. You can use the Action Chains to run this for multiple books. (chain in first attachment).

If you want to use an external tool to for lossy compression, e.g. ImageMagick, which can help convert png to jpg, you can use the Run Command action which will iterate over all images in an epub. See this post and screenshots for more details. (chain in second attachment). Note however, that you might need to edit the chain to configure the path to ImageMagick on your system.

To import the attached chains: Action Chains > Add/Modify chains > right click the chains table > import > browse to the zip file.

Note: I have found the ImageMagick approach to be much faster with lossy compression compared to the first approach that uses the editor's "Compress Images". Test with both and see which is more satisfactory.
This worked a treat. THANK YOU!
karlfranz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
batch processing regex search/replace? G2B Editor 21 11-24-2020 10:52 PM
Batch processing with kindlegen Blunaigel Kindle Formats 28 01-25-2019 11:01 AM
Batch-Processing of CSS in epub Kiruhdu Sigil 7 08-31-2018 11:44 AM
Tag editor with batch processing semenoof General Discussions 0 01-17-2013 04:12 AM
Batch processing of PDB files? Asterra iRex 6 12-04-2007 02:10 PM


All times are GMT -4. The time now is 02:20 PM.


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