View Single Post
Old 01-02-2022, 02:41 PM   #1
Mark Nord
2B || !2B
Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.
 
Posts: 854
Karma: 327896
Join Date: Feb 2010
Location: Austria
Device: Sony PRS505/650/T1/tolino vision 5
[Plugin] ImgShrinker (ImageMagick-Wrapper)

Released: January 2, 2022
Current Version: "0.0.4"

This plugin uses the ImageMagick command line utility to reduce the width of Image files while keeping the aspect-ratio.
Mostly for the use with Sony-PRS-Readers as some larger images will slow those down considerably.
(And because I'm doing this on an regular basis, and so -after all - it is worth to get a script up to do the job.)

Disclaimer: Since this plugin will replace the images in your ebook with resized images, you might want to save your ePub or create a checkpoint before running this plugin.

Credits

Doitsu: this is mostly based on his JPEGOptimizer - Lossless image optimization Plugin.
Even this posts source is shamelessly copied.

System requirements

Windows-OS (though, it should be possible to add MacOs and Linux support, but I have no chance to test on these systems)
This plugin requires at least Sigil 0.9.8. If you uncheck the Use Bundled Python option, you'll also need to install Python 3.

Installation

1. Select Manage Plugins from the Plugins menu and enable the Use Bundled Python option, if it isn't already enabled (or greyed out).
2. Click Add Plugin and select ImgShrinker_v0.0.1.zip. This will install the plugin, which you can select via Plugins > Edit > ImgShrinker.
3. Download and install ImageMagick - remember the path to the binary - it has to be set on first run

Settings

To select the new maxWidth, edit ImgShrinker.json and change the maxWidth value. For example:

Code:
  "maxWidth": "600",
To display the folder that contains ImgShrinker.json select Edit > Preferences > Open Preferences Location. Then double-click plugins_prefs and ImgShrinker.
Windows users can also press WIN+R, paste %localappdata%\sigil-ebook\sigil\plugins_prefs\ImgShrinker into the Run dialog box and hit Enter.

License: GNU General Public License v3 (GPL-3)

Thanks to generous help from DOITSU v0.0.4 - incorporating the additions from LostOnTheLine - should work for all Sigil versions >=0.9.8
Attached Files
File Type: zip ImgShrinker_v0.0.1.zip (3.8 KB, 1155 views)
File Type: zip ImgShrinker_v0.0.4.zip (16.7 KB, 13 views)

Last edited by Mark Nord; 06-26-2025 at 11:37 AM.
Mark Nord is offline   Reply With Quote