From: Stefan Kangas Date: Sun, 24 Oct 2021 16:28:20 +0000 (+0200) Subject: Add support for pngquant to image-dired X-Git-Tag: emacs-29.0.90~3671^2~438 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6498a1a3ad82c52045c07a4b2009a1ffd641dce6;p=emacs.git Add support for pngquant to image-dired * lisp/image-dired.el (image-dired-cmd-pngnq-program) (image-dired-cmd-pngnq-options): Add support for pngquant. Prefer, in this order: pngquant, pngnq-s9, pngnq-s for reasons of speed and how actively maintained the projects seem to be. --- diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 6d94624a0a8..13b2e5bc172 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -245,16 +245,23 @@ is replaced by the file name of the temporary file." :type '(repeat (string :tag "Argument"))) (defcustom image-dired-cmd-pngnq-program - (or (executable-find "pngnq") - (executable-find "pngnq-s9")) - "The file name of the `pngnq' program. + ;; Prefer pngquant to pngnq-s9 as it is faster on my machine. + ;; The project also seems more active than the alternatives. + ;; Prefer pngnq-s9 to pngnq as it fixes bugs in pngnq. + ;; The pngnq project seems dead (?) since 2011 or so. + (or (executable-find "pngquant") + (executable-find "pngnq-s9") + (executable-find "pngnq")) + "The file name of the `pngquant' or `pngnq' program. It quantizes colors of PNG images down to 256 colors or fewer using the NeuQuant algorithm." - :version "26.1" + :version "29.1" :type '(choice (const :tag "Not Set" nil) file)) (defcustom image-dired-cmd-pngnq-options - '("-f" "%t") + (if (executable-find "pngquant") + '("--ext" "-nq8.png" "%t") ; same extension as "pngnq" + '("-f" "%t")) "Arguments to pass `image-dired-cmd-pngnq-program'. Available format specifiers are the same as in `image-dired-cmd-create-thumbnail-options'."