Commit 2d71e684 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Restore image scaling support when there's no native image scaling

* lisp/net/shr.el (shr--image-type): New function.
(shr-rescale-image): Use it to allow image scaling on Emacsen with
ImageMagick support that does not have native image scaling support.
parent 26f2b1fa
Pipeline #2011 failed with stage
in 3 seconds
......@@ -1093,6 +1093,16 @@ element is the data blob and the second element is the content-type."
(insert (or alt ""))))
(defun shr--image-type ()
"Emacs image type to use when displaying images.
If Emacs has native image scaling support, that's used, but if
not, `imagemagick' is preferred if it's present."
(if (or (and (fboundp 'image-transforms-p)
(not (fboundp 'imagemagick-types)))
(defun shr-rescale-image (data content-type width height
&optional max-width max-height)
"Rescale DATA, if too big, to fit the current buffer.
......@@ -1122,13 +1132,13 @@ width/height instead."
(< (* width scaling) max-width)
(< (* height scaling) max-height))
data nil t
data (shr--image-type) t
:ascent 100
:width width
:height height
:format content-type)
data nil t
data (shr--image-type) t
:ascent 100
:max-width max-width
:max-height max-height
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment