From 9bdd44a4e4c3877cf2d62fb9888db02a95ca0ee3 Mon Sep 17 00:00:00 2001
From: kilian
Date: Tue, 12 Mar 2019 12:36:32 +0100
Subject: [PATCH 1/9] further refinement/updates of debian folder
---
debian/compat | 2 +-
debian/control | 2 +-
debian/pycompat | 1 -
debian/rules | 1 -
desktop/trimage.desktop | 2 +-
5 files changed, 3 insertions(+), 5 deletions(-)
delete mode 100644 debian/pycompat
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..80342ec 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
From 9d6edd3847743d26309f4fcf0bbda8da42869f97 Mon Sep 17 00:00:00 2001
From: Hugo Posnic
Date: Thu, 3 Oct 2019 17:05:33 +0200
Subject: [PATCH 2/9] Remove win32 bytes following d6118b5
---
trimage/tools.py | 5 ++---
trimage/trimage.py | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
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..3f7dbc3 100644
--- a/trimage/trimage.py
+++ b/trimage/trimage.py
@@ -371,10 +371,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
From 1342503b5449458d8cec23c891d526497089e235 Mon Sep 17 00:00:00 2001
From: Boyuan Yang
Date: Tue, 3 Dec 2019 17:00:44 -0500
Subject: [PATCH 3/9] Fix trimage.desktop grammar
According to https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s04.html , Keywords should be split by semicolons, not commas.
---
desktop/trimage.desktop | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/desktop/trimage.desktop b/desktop/trimage.desktop
index 80342ec..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
+Keywords=compression;compressor;images;jpg;jpeg;png;web;
From 269e052ba407c16ab32953276c776d543930b917 Mon Sep 17 00:00:00 2001
From: Kilian Valkhof
Date: Fri, 20 Dec 2019 16:51:10 +0100
Subject: [PATCH 4/9] Update README.md
---
README.md | 10 ++++++++++
1 file changed, 10 insertions(+)
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.
From c3244e19a665bc6f3ec03e10e87467a19660469a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A1lm=C3=A1n=20Tarnay?=
Date: Thu, 23 Apr 2020 17:44:12 +0200
Subject: [PATCH 5/9] add macos instructions to website
---
website/index.html | 10 ++++++++--
website/macos.png | Bin 0 -> 835 bytes
2 files changed, 8 insertions(+), 2 deletions(-)
create mode 100644 website/macos.png
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 @@
yaourt -S trimage
+
+
macOS
+ Trimage is available from Homebrew, to install, type:
+
+ brew install trimage
+
+ Launch by executing trimage in Terminal.app
+
Other *nix
- Download the source via git or bzr (see repositories)
@@ -142,8 +150,6 @@
>
diff --git a/website/macos.png b/website/macos.png
new file mode 100644
index 0000000000000000000000000000000000000000..120e1fd371a7b5212bde85f68a6295baa0aec8a3
GIT binary patch
literal 835
zcmeAS@N?(olHy`uVBq!ia0y~yU{GLSU{L2^VPIf5Qr2{wfq{V~-O<;Pfnj4m_n$;o
z1_lPEByV>Y28LC=%0>(f4D2PIzOL*~Sj73|yC}CM>cNTXMVRNFe5xn{8s43wbFuD@}jzUl{Cb3
zAGwIQYSsR@_hV6%Uq8vt
zkp1vgj;O7tlBbA9%_)rD`q8aQ@AUWB-vz#0NmajVemZ7xb>`XKFS2<*NqP#}9qxbDxiRhan`@yv
zj&0oLen|3Z@YWWcPJJDL?B#2(#_Txu(yp^D{_D)sDJ(ihhC=t=-DaAz;MAXt|MgiK
zds`BER$gRrx7AX=oT04zP#ACMdN1fmk
zn;sR9Gt;%SGYZYEI{5d*UJ}^y(|T6I9A396A|;mU_v}9P3PwgUrkl75FR6K#{@#oA
z&*MMZ86H1x_^YvO`F)jpeUkYdZb^$v`yYo)nOt2eq7}5b>SspN{kaMvmy`N~Cw^cr
ztBAn*CgRe6=_msOgKCLuL`h0wNvc(HQEFmI
zDua=Mk%6v(iLQ}xh@q*Kv4NGbp|*j6m4Sh#Rk;|7hTQy=%(P0}8Y0rquVP?eVDNPH
Kb6Mw<&;$Ui$YqZJ
literal 0
HcmV?d00001
From 493a0e18d2ac69c3bc3df6cc9998dbccd03ff409 Mon Sep 17 00:00:00 2001
From: Carson Reinke
Date: Tue, 23 Jun 2020 15:30:34 -0400
Subject: [PATCH 6/9] Missing format specifier for arguments of image status
Fixes https://github.com/Kilian/Trimage/issues/73
---
trimage/trimage.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/trimage/trimage.py b/trimage/trimage.py
index 3f7dbc3..0fd2644 100644
--- a/trimage/trimage.py
+++ b/trimage/trimage.py
@@ -304,6 +304,7 @@ 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,
'oldfilesizestr': lambda i: human_readable_size(i.oldfilesize)
@@ -331,9 +332,9 @@ class ImageRow:
message = "Compressing %s..."
return message
if not self.image.compressed and self.image.recompression:
- return "Queued for recompression..."
+ return "Queued for recompression %s..."
if not self.image.compressed:
- return "Queued..."
+ return "Queued %s..."
return "%s"
def __getitem__(self, key):
From 8af532f25ece2c01d81e6859225b7209f2f64321 Mon Sep 17 00:00:00 2001
From: Andrew Wong
Date: Wed, 30 Sep 2020 19:22:31 +1000
Subject: [PATCH 7/9] Remove unreachable shutdown code
* Implementing `__del__` is discouraged
* Imports (i.e. `import logging`) are cleaned up, leading to NoneType related errors
* When running via GUI mode, the shutdown code is never reached; we can let Python's internal GC clean everything
---
trimage/ThreadPool/ThreadPool.py | 7 -------
trimage/trimage.py | 3 ---
2 files changed, 10 deletions(-)
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/trimage.py b/trimage/trimage.py
index 3f7dbc3..1ef81be 100644
--- a/trimage/trimage.py
+++ b/trimage/trimage.py
@@ -409,9 +409,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:
From 636b5a975072fdb8159753eb28062fbed901a23d Mon Sep 17 00:00:00 2001
From: Daniele Scasciafratte
Date: Thu, 4 Mar 2021 19:26:55 +0100
Subject: [PATCH 8/9] Fix #77
This fix https://github.com/Kilian/Trimage/issues/77
As debian user this fix the issue for me
---
trimage/trimage.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/trimage/trimage.py b/trimage/trimage.py
index 7efb522..725d208 100644
--- a/trimage/trimage.py
+++ b/trimage/trimage.py
@@ -306,7 +306,7 @@ class ImageRow:
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)
@@ -335,7 +335,7 @@ class ImageRow:
return "Queued for recompression %s..."
if not self.image.compressed:
return "Queued %s..."
- return "%s"
+ return "{0}"
def __getitem__(self, key):
return self.d[key](self.image)
From 031adf60540614355620ce8eaa01a4c63a085d62 Mon Sep 17 00:00:00 2001
From: Daniele Scasciafratte
Date: Wed, 10 Mar 2021 12:58:46 +0100
Subject: [PATCH 9/9] Fix incomplete code of #77
I forgot to change the various `%s` in the pull request with the rest of the function or it will be print "Compressing %s".
---
trimage/trimage.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/trimage/trimage.py b/trimage/trimage.py
index 725d208..b618b4b 100644
--- a/trimage/trimage.py
+++ b/trimage/trimage.py
@@ -327,14 +327,14 @@ 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 %s..."
+ return "Queued for recompression {0}..."
if not self.image.compressed:
- return "Queued %s..."
+ return "Queued {0}..."
return "{0}"
def __getitem__(self, key):