diff options
| -rw-r--r-- | lisp/net/shr.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index c1e9fdd30d7..a014c56948c 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -1093,6 +1093,16 @@ element is the data blob and the second element is the content-type." | |||
| 1093 | image) | 1093 | image) |
| 1094 | (insert (or alt "")))) | 1094 | (insert (or alt "")))) |
| 1095 | 1095 | ||
| 1096 | (defun shr--image-type () | ||
| 1097 | "Emacs image type to use when displaying images. | ||
| 1098 | If Emacs has native image scaling support, that's used, but if | ||
| 1099 | not, `imagemagick' is preferred if it's present." | ||
| 1100 | (if (or (and (fboundp 'image-transforms-p) | ||
| 1101 | (image-transforms-p)) | ||
| 1102 | (not (fboundp 'imagemagick-types))) | ||
| 1103 | nil | ||
| 1104 | 'imagemagick)) | ||
| 1105 | |||
| 1096 | (defun shr-rescale-image (data content-type width height | 1106 | (defun shr-rescale-image (data content-type width height |
| 1097 | &optional max-width max-height) | 1107 | &optional max-width max-height) |
| 1098 | "Rescale DATA, if too big, to fit the current buffer. | 1108 | "Rescale DATA, if too big, to fit the current buffer. |
| @@ -1122,13 +1132,13 @@ width/height instead." | |||
| 1122 | (< (* width scaling) max-width) | 1132 | (< (* width scaling) max-width) |
| 1123 | (< (* height scaling) max-height)) | 1133 | (< (* height scaling) max-height)) |
| 1124 | (create-image | 1134 | (create-image |
| 1125 | data nil t | 1135 | data (shr--image-type) t |
| 1126 | :ascent 100 | 1136 | :ascent 100 |
| 1127 | :width width | 1137 | :width width |
| 1128 | :height height | 1138 | :height height |
| 1129 | :format content-type) | 1139 | :format content-type) |
| 1130 | (create-image | 1140 | (create-image |
| 1131 | data nil t | 1141 | data (shr--image-type) t |
| 1132 | :ascent 100 | 1142 | :ascent 100 |
| 1133 | :max-width max-width | 1143 | :max-width max-width |
| 1134 | :max-height max-height | 1144 | :max-height max-height |