Function: gnus-rescale-image
gnus-rescale-image is a byte-compiled function defined in
gnus-util.el.gz.
Signature
(gnus-rescale-image IMAGE SIZE)
Documentation
Rescale IMAGE to SIZE if possible.
SIZE is in format (WIDTH . HEIGHT). Return a new image. Sizes are in pixels.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-util.el.gz
(defun gnus-rescale-image (image size)
"Rescale IMAGE to SIZE if possible.
SIZE is in format (WIDTH . HEIGHT). Return a new image.
Sizes are in pixels."
(when (display-images-p)
(declare-function image-size "image.c" (spec &optional pixels frame))
(let ((new-width (car size))
(new-height (cdr size)))
(when (> (cdr (image-size image t)) new-height)
(setq image (create-image (plist-get (cdr image) :data) nil t
:max-height new-height)))
(when (> (car (image-size image t)) new-width)
(setq image (create-image (plist-get (cdr image) :data) nil t
:max-width new-width)))))
image)