[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-28 f5421104e9: Fix external image conversion on MS-Windows
From: |
Eli Zaretskii |
Subject: |
emacs-28 f5421104e9: Fix external image conversion on MS-Windows |
Date: |
Thu, 30 Jun 2022 06:51:28 -0400 (EDT) |
branch: emacs-28
commit f5421104e9753a2d3ead19ba31ac5ed1f3a5c03a
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix external image conversion on MS-Windows
* lisp/image/image-converter.el (image-converter--convert-magick)
(image-converter--convert): Force encoding/decoding to avoid any
text or EOL conversions, since we are reading/writing binary
data. (Bug#56317)
---
lisp/image/image-converter.el | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el
index 460ff16adb..d3d560f021 100644
--- a/lisp/image/image-converter.el
+++ b/lisp/image/image-converter.el
@@ -227,19 +227,21 @@ Only suffixes that map to `image-mode' are returned."
(cadr (split-string (symbol-name image-format) "/"))))
(defun image-converter--convert-magick (type source image-format)
- (let ((command (image-converter--value type :command)))
+ (let ((command (image-converter--value type :command))
+ (coding-system-for-read 'no-conversion))
(unless (zerop (if image-format
;; We have the image data in SOURCE.
(progn
(insert source)
- (apply #'call-process-region (point-min) (point-max)
- (car command) t t nil
- (append
- (cdr command)
- (list (format "%s:-"
- (image-converter--mime-type
- image-format))
- "png:-"))))
+ (let ((coding-system-for-write 'no-conversion))
+ (apply #'call-process-region (point-min) (point-max)
+ (car command) t t nil
+ (append
+ (cdr command)
+ (list (format "%s:-"
+ (image-converter--mime-type
+ image-format))
+ "png:-")))))
;; SOURCE is a file name.
(apply #'call-process (car command)
nil t nil
@@ -252,18 +254,20 @@ Only suffixes that map to `image-mode' are returned."
(cl-defmethod image-converter--convert ((type (eql 'ffmpeg)) source
image-format)
"Convert using ffmpeg."
- (let ((command (image-converter--value type :command)))
+ (let ((command (image-converter--value type :command))
+ (coding-system-for-read 'no-conversion))
(unless (zerop (if image-format
(progn
(insert source)
- (apply #'call-process-region
- (point-min) (point-max) (car command)
- t '(t nil) nil
- (append
- (cdr command)
- (list "-i" "-"
- "-c:v" "png"
- "-f" "image2pipe" "-"))))
+ (let ((coding-system-for-write 'no-conversion))
+ (apply #'call-process-region
+ (point-min) (point-max) (car command)
+ t '(t nil) nil
+ (append
+ (cdr command)
+ (list "-i" "-"
+ "-c:v" "png"
+ "-f" "image2pipe" "-")))))
(apply #'call-process
(car command)
nil '(t nil) nil
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-28 f5421104e9: Fix external image conversion on MS-Windows,
Eli Zaretskii <=