>From dfc19db48f85538b0d60cd0b1e0787811f8daca2 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 30 Jun 2019 15:24:46 +0100 Subject: [PATCH] Default to ImageMagick when transforms are requested * lisp/image.el (create-image): Default to ImageMagick when transforms are requested. --- lisp/image.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lisp/image.el b/lisp/image.el index b58b1dc954..70c988857c 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -436,13 +436,24 @@ create-image Image file names that are not absolute are searched for in the \"images\" sub-directory of `data-directory' and `x-bitmap-file-path' (in that order)." + (when (not (plist-get props :scale)) + (let ((scale (image-compute-scaling-factor image-scaling-factor))) + (when (/= 1 scale) (setq props (append (list :scale scale) props))))) + ;; Default to ImageMagick if a transform is requested. + (if (and (not type) + (fboundp 'imagemagick-types) + (or (plist-get props :scale) + (plist-get props :width) + (plist-get props :height) + (plist-get props :max-width) + (plist-get props :max-height) + (plist-get props :rotation) + (plist-get props :crop))) + (setq type 'imagemagick)) ;; It is x_find_image_file in image.c that sets the search path. (setq type (image-type file-or-data type data-p)) (when (image-type-available-p type) (append (list 'image :type type (if data-p :data :file) file-or-data) - (and (not (plist-get props :scale)) - (list :scale - (image-compute-scaling-factor image-scaling-factor))) props))) (defun image--set-property (image property value) -- 2.21.0