+(defun mml--possibly-alter-image (file-name image)
+ (if (or (null image)
+ (not (consp image))
+ (not (eq (car image) 'image))
+ (not (image-property image :rotation))
+ (not (executable-find "exiftool")))
+ `((filename . ,file-name))
+ `((filename . ,file-name)
+ (buffer
+ .
+ ,(with-current-buffer (mml-generate-new-buffer " *mml rotation*")
+ (set-buffer-multibyte nil)
+ (call-process "exiftool"
+ file-name
+ (list (current-buffer) nil)
+ nil
+ (format "-Orientation#=%d"
+ (cl-case (truncate
+ (image-property image :rotation))
+ (0 0)
+ (90 6)
+ (180 3)
+ (270 8)
+ (otherwise 0)))
+ "-o" "-"
+ "-")
+ (current-buffer))))))
+