Calibre already offers this functionality without any plugin. It's part of the ebook editor that installs with Calibre.
The editor will only edit files in the epub or azw3 format though. You can convert the mobi file to azw3 and then edit it. Converting it from mobi to azw3 may automatically downsize the file, but I'm not sure.
Once you have the file ...
If the book has not a DRM and you are free to edit/convert it, you can use Calibre to convert to the same format (i.e. you can use an .epub as a source file and still convert to an .epub output.
In the Heuristic processing tab make sure to enable both the processing and Remove unnecessary hyphenation; if you want you can also enable other options here if ...
Note: I intended to leave this as a comment for @mosh but didn't have the necessary rep. This is my own personal solution based on the solution he outlined. This will recursively scan a specified directory and compress files larger than 49MB, overwriting the original files. [I chose that size due to the fact that Google Play Books uploads are limited to 50MB ...
I had a similar situation: a 134 MB .mobi that I wanted to shrink.
Here's how I reduced the file size to 26 MB. The key to this approach is that an .epub is actually just a zipped web page with image files in it.
Converted the .mobi to .epub with Calibre.
Renamed the .epub to .zip.
Extracted the .zip. Note the images subfolder. Mine had more than 1000 ...
Limiting compatibility issues
Perform a validation of the file structure. See this question about this subject.
Making it faster to load
Keep the size of individual internal HTML files small. The reader usually load them individually when needed, and it is (obviously) faster to load a small file than a big one; as a rule of thumb the size limit is ...
The EPUB 3 specification1 suggests including embedded fonts for compatibility:
EPUB 3 does not require that Reading Systems come with any particular
set of built-in system fonts. As occurs in Web contexts, Users in a
particular locale might have installed fonts that omit characters
required for other locales, and Reading Systems might utilize
bash script to for bulk compressing images in big.epub to small.epub on Windows7 or Linux.
You need to install cygwin on windows for (bash, unzip, zip, find, imagemagick).
USAGE="Usage: $0 big.epub small.epub"
unzip -d $1-tmp $1 # unzip big.epub in tmp directory
# Compress all images larger than NxN in ...
Here is a Python script I use to automate reducing the size of epub books:
$ python epub-shrink/app.py input_file.epub output_file.epub --jpeg-quality=25
Define what is: "fix it at the first place".
If you want to fix wrong output from OCR analysis, a simple solution on an infinite set of TOCs you will never make.
You will never apply all variations. You would have to create a machine learning algorithm that would analyze each TOC variant.
Or count substrings of the same characteristics (in simple TOC).
You cannot optimize and make it faster to load and to be processed from the reader in a generic way for all possible readers and probably not for all available readers¹.
The reason is that there are conflicting elements involved that lead to different loading results on different device hardware configurations. For the reading device these configurations ...
The short answer is that with few exceptions you should NEVER need to scale down .mobi files because Amazon.com will do it for you.
I think 5.5 MB is a reasonable file size for an epub file. I don't know if it is a typo, but 60MB is a bit high for mobi files.
However, when you buy a .mobi file directly from the publisher, the preferred way to get it to ...
Such hard hyphens are usually the result of a bad conversion from pdf to epub/mobi. I got them in books I regularly bought, so it's not a problem of piracy: my impression is that even today publishers start with a pdf file (made with InDesign or similar), and they forgot that some words are hyphenated.
If the book had no DRM, sometimes I decided to use Sigil ...