![]() |
ImageOptimizer
1 Attachment(s)
This is an edit plugin that should work on Windows, Linux and OSX.
It is a wrapper plugin around several image optimization programs. It can optimize optimize JPG, PNG and GIF images. The programs used are equal to my ePUBOptimizer program, but this plugin is Python only and will not subset fonts. Prereqs: Sigil 0.8.2 (or higher). On Sigil 0.9.3 and higher it will make use of autostart and autoclose. Prerequisite is that on Linux the programs jpegtran/optipng/gifsicle are required. For Windows and OSX these are included. The program jpegtran is included in libjpeg-progs on Linux. Upon first execution a preference file will be created in the plugin_prefs directory. If required another version of jpegtran can be entered or the usage of wine, and thereby the included windows executables, can be activated. By default the standard jpegtran will be used and is wine not enabled. Current Version: "0.2.1" |
Hi
Thank very much you for porting this plugin to Sigil. I tried it on Archlinux 64 bits with Sigil 9.2. I installed optipng and gifsicle. However I did not find jpegtran or libjpeg-progs (they probably have other names) and so my trial for today was unconclusive (the program kept waiting left-right-left-right...). I had good hopes since I use Imagemagick 6.9.3. but no. |
Roger, a quick search for Archlinux tells me that the library libjpeg-turbo contains jpegtran. That should do the trick.
It is strange the program kept waiting, it should just report the return code if the program is not found. |
roger64 -- in future, an excellent way to find needed programs on Arch Linux is to use "pkgfile". :)
libjpeg-turbo is required by qt5-base, so it is already an indirect dependency of sigil. |
Thanks for pkgfile. I did not not know.
I installed this libjpeg-turbo to learn that.. it was already installed. So, the situation is the same: the plugin does not work for me on one valid EPUB3 file with three jpegs. It keeps "running" and never stops. |
Can you see in the process list the hpegtrans program running? So maybe the plugin is just waiting for the exteranl program which is waiting for whatever.
|
I will check again on my Linux machines.
|
Quote:
The old version has the following syntax: Code:
usage: jpegtran [switches] [inputfile]Code:
usage: jpegtran [switches] [inputfile] [outputfile]AFAIK, libjpeg-turbo is a fork of jpegtran that uses the old syntax. I.e. you can't use it to optimize .jpeg files under Linux. |
@Doitsu
I don't know if this answers your question. It's cryptic for me :) Code:
[roger@anterg ~]$ jpegtran -vCode:
[roger@anterg ~]$ locate jpegtran |
Quote:
|
@roger64: The jpegtran version that you've installed is the fork that I mentioned that still uses the old syntax and will most likely not work.
I'd recommend the following workaround: 1. Install the Wine windows emulator, if you haven't already done so. 2. Change lines 83 and 85 in plugin.py as follows: old version: Code:
exe_path = 'jpegtran'Code:
exe_path = os.path.join(SCRIPT_DIR,'win', 'jpegtran.exe') |
Why not allow the user to override paths to external programs via the prefs json?
Code:
prefs = bk.get_prefs()Code:
islinux = sys.platform.startswith('linux')That way the user can just modify the json prefs file to 1) point to a newer version of jpegtran (which I'm betting calibre's is); or 2) use wine to run the included Windows version. |
1 Attachment(s)
Quote:
The images went from 146 to 127k 334 to 244k 863 to 812k |
Quote:
|
Quote:
|
| All times are GMT -4. The time now is 08:30 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.