Function: image-dired-pngcrush-thumb
image-dired-pngcrush-thumb is a byte-compiled function defined in
image-dired-external.el.gz.
Signature
(image-dired-pngcrush-thumb SPEC)
Documentation
Optimize thumbnail described by format SPEC with command pngcrush.
Source Code
;; Defined in /usr/src/emacs/lisp/image/image-dired-external.el.gz
(defun image-dired-pngcrush-thumb (spec)
"Optimize thumbnail described by format SPEC with command `pngcrush'."
;; If pngnq wasn't run, then the THUMB-nq8.png file does not exist.
;; pngcrush needs an infile and outfile, so we just copy THUMB to
;; THUMB-nq8.png and use the latter as a temp file.
(when (not image-dired-cmd-pngnq-program)
(let ((temp (cdr (assq ?q spec)))
(thumb (cdr (assq ?t spec))))
(copy-file thumb temp)))
(let ((process
(apply #'start-process "image-dired-pngcrush" nil
image-dired-cmd-pngcrush-program
(mapcar (lambda (arg) (format-spec arg spec))
image-dired-cmd-pngcrush-options))))
(setf (process-sentinel process)
(lambda (process status)
(unless (and (eq (process-status process) 'exit)
(zerop (process-exit-status process)))
(message "command %S %s" (process-command process)
(string-replace "\n" "" status)))
(when (memq (process-status process) '(exit signal))
(let ((temp (cdr (assq ?q spec))))
(delete-file temp)))))
process))