Function: image-converter--convert-magick

image-converter--convert-magick is a byte-compiled function defined in image-converter.el.gz.

Signature

(image-converter--convert-magick TYPE SOURCE IMAGE-FORMAT)

Source Code

;; Defined in /usr/src/emacs/lisp/image/image-converter.el.gz
(defun image-converter--convert-magick (type source image-format)
  (let ((command (image-converter--value type :command))
        (coding-system-for-read 'no-conversion))
    (unless (zerop (if image-format
                       ;; We have the image data in SOURCE.
                       (progn
                         (insert source)
                         (let ((coding-system-for-write 'no-conversion))
                           (apply #'call-process-region (point-min) (point-max)
                                  (car command) t t nil
                                  (append
                                   (cdr command)
                                   (list (format "%s:-"
                                                 (image-converter--mime-type
                                                  image-format))
                                       (concat image-convert-to-format
                                               ":-"))))))
                     ;; SOURCE is a file name.
                     (apply #'call-process (car command)
                            nil t nil
                            (append (cdr command)
                                    (list (expand-file-name source)
                                          (concat image-convert-to-format
                                                  ":-"))))))
      ;; If the command failed, hopefully the buffer contains the
      ;; error message.
      (buffer-string))))