Quote:
Originally Posted by Doitsu
Can you please check the version number of jpegtran? Toxaris's plugin uses version 9, which uses a different syntax than the previous version which accepts only one file name parameter.
|
Looks to me like it uses the old syntax, actually.
Code:
elif (filename.lower().endswith('.jpg') or filename.lower().endswith('.jpeg')) :
# get correct arguments
if iswindows:
exe_path = os.path.join(SCRIPT_DIR,'win', 'jpegtran.exe')
elif isosx:
exe_path = os.path.join(SCRIPT_DIR,'osx','jpegtran')
else:
exe_path = 'jpegtran'
args = [exe_path]
args.append("-optimize")
args.append("-progressive")
args.append("-copy")
args.append("none")
args.append("-outfile")
args.append(filename)
args.append(filename)
The outfile is passed via -outfile, not as the last argument... exactly as both libjpeg-turbo and mozjpeg expect.
In fact, you
can use libjpeg's version 9 executable with either syntax. Which is I guess why Toxaris used the old syntax.
Quote:
The old version has the following syntax:
Code:
usage: jpegtran [switches] [inputfile]
however, the new version uses the following syntax:
Code:
usage: jpegtran [switches] [inputfile] [outputfile]
If you use the new syntax with the old version, it enters an endless loop, which causes the plugin to hang.
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.
|
What -- because it uses the old syntax, this file optimizer doesn't work on linux? Or the plugin cannot use it?
Because I am pretty sure both are untrue.
Also, on my machine, using the libjpeg version 9 syntax with libjpeg-turbo (or mozjpeg) does exactly what I expect -- it immediately returns a failure:
Code:
jpegtran: only one input file
usage...
Quote:
Originally Posted by DiapDealer
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.
|
calibre uses jpegtran from the latest version of mozjpeg, rather than using libjpeg-turbo (the latest version of which is on roger64's machine).
mozjpeg and libjpeg-turbo are both equally NOT libjpeg.
....
I suppose the real question is, why are you using subprocess.call(list(args), shell=True)
subprocess.call(args) works fine without any other changes.
(Don't use a shell. Minor nit: don't convert a list into a list)