Function: image-dired-display-image
image-dired-display-image is a byte-compiled function defined in
image-dired.el.gz.
Signature
(image-dired-display-image FILE &optional ORIGINAL-SIZE)
Documentation
Display image FILE in image buffer.
Use this when you want to display the image, semi sized, in a new window. The image is sized to fit the display window (using a temporary file, don't worry). Because of this, it will not be as quick as opening it directly, but on most modern systems it should feel snappy enough.
If optional argument ORIGINAL-SIZE is non-nil, display image in its original size.
Source Code
;; Defined in /usr/src/emacs/lisp/image-dired.el.gz
(defun image-dired-display-image (file &optional original-size)
"Display image FILE in image buffer.
Use this when you want to display the image, semi sized, in a new
window. The image is sized to fit the display window (using a
temporary file, don't worry). Because of this, it will not be as
quick as opening it directly, but on most modern systems it
should feel snappy enough.
If optional argument ORIGINAL-SIZE is non-nil, display image in its
original size."
(image-dired--check-executable-exists
'image-dired-cmd-create-temp-image-program)
(let ((new-file (expand-file-name image-dired-temp-image-file))
(window (image-dired-display-window))
(image-type 'jpeg))
(setq file (expand-file-name file))
(if (not original-size)
(let* ((spec
(list
(cons ?p image-dired-cmd-create-temp-image-program)
(cons ?w (image-dired-display-window-width window))
(cons ?h (image-dired-display-window-height window))
(cons ?f file)
(cons ?t new-file)))
(ret
(apply #'call-process
image-dired-cmd-create-temp-image-program nil nil nil
(mapcar
(lambda (arg) (format-spec arg spec))
image-dired-cmd-create-temp-image-options))))
(when (not (zerop ret))
(error "Could not resize image")))
(setq image-type (image-type-from-file-name file))
(copy-file file new-file t))
(with-current-buffer (image-dired-create-display-image-buffer)
(let ((inhibit-read-only t))
(erase-buffer)
(clear-image-cache)
(image-dired-insert-image image-dired-temp-image-file image-type 0 0)
(goto-char (point-min))
(set-window-vscroll window 0)
(set-window-hscroll window 0)
(image-dired-update-property 'original-file-name file)))))