diff --git a/debian/control b/debian/control index 68bdb14..26fb0f9 100644 --- a/debian/control +++ b/debian/control @@ -9,11 +9,11 @@ Homepage: http://trimage.org Package: trimage Architecture: all -Depends: ${misc:Depends}, ${python:Depends}, python-qt4 (>=4.4), optipng (>=0.6.2.1), advancecomp (>=1.15), jpegoptim (>=1.2.2), pngcrush (>=1.6.7) +Depends: ${misc:Depends}, ${python:Depends}, python-qt4 (>=4.4), optipng (>=0.6.2.1), advancecomp (>=1.15), guetzli, pngcrush (>=1.6.7) XB-Python-Version: ${python:Versions} Description: GUI and command-line interface to optimize image files Trimage is a cross-platform GUI and command-line interface to optimize image - files via optipng, advpng, pngcrush and jpegoptim, depending on the filetype + files via optipng, advpng, pngcrush and guetzli, depending on the filetype (currently, PNG and JPG files are supported). All image files are losslessly compressed on the highest available compression levels. Trimage gives you various input functions to fit your own workflow: A regular file dialog, diff --git a/desktop/trimage.desktop b/desktop/trimage.desktop index 2cf870a..6cd6632 100644 --- a/desktop/trimage.desktop +++ b/desktop/trimage.desktop @@ -1,6 +1,8 @@ [Desktop Entry] Name=Trimage image compressor -Comment=A cross-platform tool for optimizing PNG and JPG files. +Name[ru]=Программа для уменьшения веса картинок Trimage +Comment=A cross-platform tool for optimizing PNG and JPG files +Comment[ru]=Кросс-платформенная утилита для оптимизации файлов PNG и JPG Terminal=false Icon=trimage Type=Application diff --git a/setup.py b/setup.py index bae6f17..08a5db7 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ setup(name = "trimage", ('share/applications', ['desktop/trimage.desktop']), ('share/man/man1', ['doc/trimage.1'])], scripts = ["trimage"], - long_description = """Trimage is a cross-platform GUI and command-line interface to optimize image files via optipng, advpng and jpegoptim, depending on the filetype (currently, PNG and JPG files are supported). It was inspired by imageoptim. All image files are losslessy compressed on the highest available compression levels. Trimage gives you various input functions to fit your own workflow: A regular file dialog, dragging and dropping and various command line options.""", + long_description = """Trimage is a cross-platform GUI and command-line interface to optimize image files via optipng, advpng and guetzli, depending on the filetype (currently, PNG and JPG files are supported). It was inspired by imageoptim. All image files are losslessy compressed on the highest available compression levels. Trimage gives you various input functions to fit your own workflow: A regular file dialog, dragging and dropping and various command line options.""", requires = ["PyQt4 (>=4.4)"], #for py2exe diff --git a/src/trimage/trimage.py b/src/trimage/trimage.py index 84b13a0..e841f04 100644 --- a/src/trimage/trimage.py +++ b/src/trimage/trimage.py @@ -22,7 +22,8 @@ from multiprocessing import cpu_count from ui import Ui_trimage -VERSION = "1.0.5" +# change version to 1.1 after replacing jpegoptim with guetzli +VERSION = "1.1" class StartQT4(QMainWindow): @@ -86,7 +87,7 @@ class StartQT4(QMainWindow): """Set up the command line options.""" parser = OptionParser(version="%prog " + VERSION, description="GUI front-end to compress png and jpg images via " - "optipng, advpng and jpegoptim") + "optipng, advpng and guetzli") parser.set_defaults(verbose=True) parser.add_option("-v", "--verbose", action="store_true", @@ -261,10 +262,12 @@ class StartQT4(QMainWindow): """Check if the required command line apps exist.""" exe = ".exe" if (sys.platform == "win32") else "" status = False - retcode = self.safe_call("jpegoptim" + exe + " --version") - if retcode != 0: - status = True - sys.stderr.write("[error] please install jpegoptim") + + # guetzli does the compression job much better than jpegoptim (and much slower) + #retcode = self.safe_call("jpegoptim" + exe + " --version") + #if retcode != 0: + #status = True + #sys.stderr.write("[error] please install jpegoptim") retcode = self.safe_call("optipng" + exe + " -v") if retcode != 0: @@ -281,6 +284,13 @@ class StartQT4(QMainWindow): status = True sys.stderr.write("[error] please install pngcrush") return status + + # guetzli currently does not have neither --version not --help flags + retcode = self.safe_call("guetzli" + exe) + if retcode != 0: + status = True + sys.stderr.write("[error] please install guetzli") + return status def safe_call(self, command): """ cross-platform command-line check """ @@ -431,7 +441,10 @@ class Image: self.compressing = True exe = ".exe" if (sys.platform == "win32") else "" runString = { - "jpeg": u"jpegoptim" + exe + " -f --strip-all '%(file)s'", + # "jpeg": u"jpegoptim" + exe + " -f --strip-all '%(file)s'", + # I commented out jpegoptim because guetzli compresses MUCH BETTER having a similar output quality + # the default quality level for guetzli, if the parameter '--quality Q' is not passed, it 95. + "jpeg": u"guetzli" + exe + " --quality 95 '%(file)s' '%(file)s.bak' && mv '%(file)s.bak' '%(file)s'", "png": u"optipng" + exe + " -force -o7 '%(file)s'&&advpng" + exe + " -z4 '%(file)s' && pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time '%(file)s' '%(file)s.bak' && mv '%(file)s.bak' '%(file)s'" } # Create a backup file diff --git a/trimage b/trimage old mode 100644 new mode 100755