[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#56317: 28.1; image-convert not working on Windows
From: |
Eli Zaretskii |
Subject: |
bug#56317: 28.1; image-convert not working on Windows |
Date: |
Thu, 30 Jun 2022 09:46:39 +0300 |
> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Thu, 30 Jun 2022 08:16:43 +0200
>
>
> image-converter dosesn(t work with emacs 28.1 on Windows
> 10. I start with:
>
> runemacs -Q
>
> then:
>
> (auto-image-file-mode 1)
> (setq image-use-external-converter t
> image-converter 'graphicsmagick)
>
> GrpahicsMagick 1.3.36 Q16 win64 is installed and working fine. I can
> test an image in SunRaster format:
>
> (image-convert-p "C:/Users/.../img.ras") -> image-convert
>
> then I enter:
>
> (add-to-list 'auto-mode-alist '("\\.ras\\'" . image-mode))
>
> and if I visit the sunraster file I get the following error in the
> Messages buffer:
>
> Not a PNG image: ‘(image :type png :data \211PNG
> ^Z
> ...
>
Thanks. Please try the patch below:
diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el
index 460ff16..43903ff 100644
--- a/lisp/image/image-converter.el
+++ b/lisp/image/image-converter.el
@@ -227,19 +227,21 @@ image-converter--mime-type
(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