Function: image-dired-optipng-thumb

image-dired-optipng-thumb is a byte-compiled function defined in image-dired-external.el.gz.

Signature

(image-dired-optipng-thumb SPEC)

Documentation

Optimize thumbnail described by format SPEC with command optipng.

Source Code

;; Defined in /usr/src/emacs/lisp/image/image-dired-external.el.gz
(defun image-dired-optipng-thumb (spec)
  "Optimize thumbnail described by format SPEC with command `optipng'."
  (let* ((args (mapcar
                (lambda (arg)
                  (format-spec arg spec))
                image-dired-cmd-optipng-options))
         (snt (lambda (process status)
                (unless (or (and (processp process)
                                 (eq (process-status process) 'exit)
                                 (zerop (process-exit-status process)))
                            (zerop status))
                  (if (processp process)
                      (message "command %S %s" (process-command process)
                               (string-replace "\n" "" status))
                    (message "command %S failed with status %s"
                             process status)))))
         (proc
          (if (eq system-type 'windows-nt)
              ;; See above for the reasons we don't use 'start-process'
              ;; on MS-Windows.
              (apply #'call-process
                     image-dired-cmd-optipng-program nil nil nil args)
            (apply #'start-process "image-dired-optipng" nil
                   image-dired-cmd-optipng-program args))))
    (if (processp proc)
        (setf (process-sentinel proc) snt)
      (funcall snt image-dired-cmd-optipng-program proc))
    proc))