-(defun gnus-html-rescale-image (image data size)
- (if (or (not (fboundp 'imagemagick-types))
- (not (get-buffer-window (current-buffer))))
- image
- (let* ((width (car size))
- (height (cdr size))
- (edges (window-inside-pixel-edges (get-buffer-window (current-buffer))))
- (window-width (truncate (* gnus-max-image-proportion
- (- (nth 2 edges) (nth 0 edges)))))
- (window-height (truncate (* gnus-max-image-proportion
- (- (nth 3 edges) (nth 1 edges)))))
- scaled-image)
- (when (> height window-height)
- (setq image (or (create-image data 'imagemagick t
- :height window-height)
- image))
- (setq size (image-size image t)))
- (when (> (car size) window-width)
- (setq image (or
- (create-image data 'imagemagick t
- :width window-width)
- image)))
- image)))
-