diff --git a/README.md b/README.md index 288cbf5..75b2061 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ +### Made by [@kilianvalkhof](https://twitter.com/kilianvalkhof) + +#### Other projects: + +- 💻 [Polypane](https://polypane.app) - Develop responsive websites and apps twice as fast on multiple screens at once +- 🖌️ [Superposition](https://superposition.design) - Kickstart your design system by extracting design tokens from your website +- 🗒️ [FromScratch](https://fromscratch.rocks) - A smart but simple autosaving scratchpad + +--- + # Trimage image compressor A cross-platform tool for optimizing PNG and JPG files. diff --git a/debian/compat b/debian/compat index f599e28..b4de394 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -10 +11 diff --git a/debian/control b/debian/control index 9646ecf..7396a46 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: graphics Priority: optional Maintainer: Kilian Valkhof Build-Depends: debhelper (>=7), python3 -Standards-Version: 3.9.2 +Standards-Version: 4.3.0 Homepage: http://trimage.org Package: trimage diff --git a/debian/pycompat b/debian/pycompat deleted file mode 100644 index 00750ed..0000000 --- a/debian/pycompat +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/debian/rules b/debian/rules index 4f2c774..cbe925d 100755 --- a/debian/rules +++ b/debian/rules @@ -1,4 +1,3 @@ #!/usr/bin/make -f %: dh $@ - diff --git a/desktop/trimage.desktop b/desktop/trimage.desktop index 2cf870a..8b48fa6 100644 --- a/desktop/trimage.desktop +++ b/desktop/trimage.desktop @@ -7,4 +7,4 @@ Type=Application Exec=trimage Categories=Application;Qt;Graphics; StartupNotify=true - +Keywords=compression;compressor;images;jpg;jpeg;png;web; diff --git a/trimage/ThreadPool/ThreadPool.py b/trimage/ThreadPool/ThreadPool.py index 9f9e051..17e55e4 100644 --- a/trimage/ThreadPool/ThreadPool.py +++ b/trimage/ThreadPool/ThreadPool.py @@ -30,9 +30,6 @@ class ThreadPoolMixIn: def __init__(self, threadpool=None): if (threadpool == None): threadpool = ThreadPool() - self.__private_threadpool = True - else: - self.__private_threadpool = False self.__threadpool = threadpool @@ -52,10 +49,6 @@ class ThreadPoolMixIn: def process_request(self, request, client_address): self.__threadpool.add_job(self.process_request_thread, [request, client_address]) - def shutdown(self): - if (self.__private_threadpool): self.__threadpool.shutdown() - - class AddJobException(Exception): ''' Exceptoion raised when a Job could not be added diff --git a/trimage/tools.py b/trimage/tools.py index f787c8c..98e0218 100644 --- a/trimage/tools.py +++ b/trimage/tools.py @@ -7,7 +7,6 @@ from subprocess import call, PIPE def check_dependencies(): """Check if the required command line apps exist.""" - exe = ".exe" if (sys.platform == "win32") else "" status = True dependencies = { "jpegoptim": "--version", @@ -17,7 +16,7 @@ def check_dependencies(): } for elt in dependencies: - retcode = safe_call(elt + exe + " " + dependencies[elt]) + retcode = safe_call(elt + " " + dependencies[elt]) if retcode != 0: status = False print("[error] please install {}".format(elt), file=sys.stderr) @@ -43,4 +42,4 @@ def human_readable_size(num, suffix="B"): if abs(num) < 1024.0: return "%3.1f%s%s" % (num, unit, suffix) num /= 1024.0 - return "%.1f%s%s" % (num, "Y", suffix) \ No newline at end of file + return "%.1f%s%s" % (num, "Y", suffix) diff --git a/trimage/trimage.py b/trimage/trimage.py index 2fefedf..b618b4b 100644 --- a/trimage/trimage.py +++ b/trimage/trimage.py @@ -304,8 +304,9 @@ class ImageRow: def __init__(self, image, waitingIcon=None): """Build the information visible in the table image row.""" self.image = image + d = { - 'filename_w_ext': lambda i: self.statusStr() % i.filename_w_ext, + 'filename_w_ext': lambda i: self.statusStr().format(i.filename_w_ext), 'oldfilesizestr': lambda i: human_readable_size(i.oldfilesize) if i.compressed else "", 'newfilesizestr': lambda i: human_readable_size(i.newfilesize) @@ -326,15 +327,15 @@ class ImageRow: def statusStr(self): """Set the status message.""" if self.image.failed: - return "ERROR: %s" + return "ERROR: {0}" if self.image.compressing: - message = "Compressing %s..." + message = "Compressing {0}..." return message if not self.image.compressed and self.image.recompression: - return "Queued for recompression..." + return "Queued for recompression {0}..." if not self.image.compressed: - return "Queued..." - return "%s" + return "Queued {0}..." + return "{0}" def __getitem__(self, key): return self.d[key](self.image) @@ -371,10 +372,9 @@ class Image: file)" self.reset() self.compressing = True - exe = ".exe" if (sys.platform == "win32") else "" runString = { - "jpeg": "jpegoptim" + exe + " -f --strip-all '%(file)s'", - "png": "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'" + "jpeg": "jpegoptim -f --strip-all '%(file)s'", + "png": "optipng -force -o7 '%(file)s'&&advpng -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 backupfullpath = '/tmp/' + self.filename_w_ext @@ -410,9 +410,6 @@ class Worker(QThread): self.toDisplay = Queue() self.threadpool = ThreadPool(max_workers=cpu_count()) - def __del__(self): - self.threadpool.shutdown() - def compress_file(self, images, showapp, verbose, imagelist): """Start the worker thread.""" for image in images: diff --git a/website/index.html b/website/index.html index 0598c85..0e7995a 100644 --- a/website/index.html +++ b/website/index.html @@ -125,6 +125,14 @@
  1. yaourt -S trimage
+ +

macOS

+ Trimage is available from Homebrew, to install, type: +
    +
  1. brew install trimage
  2. +
+

Launch by executing trimage in Terminal.app

+

Other *nix

  1. Download the source via git or bzr (see repositories)
  2. @@ -142,8 +150,6 @@ >

    diff --git a/website/macos.png b/website/macos.png new file mode 100644 index 0000000..120e1fd Binary files /dev/null and b/website/macos.png differ