unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Pascal Quesseveur <pquessev@gmail.com>
Cc: 56317@debbugs.gnu.org
Subject: bug#56317: 28.1; image-convert not working on Windows
Date: Thu, 30 Jun 2022 09:46:39 +0300	[thread overview]
Message-ID: <83edz66434.fsf@gnu.org> (raw)
In-Reply-To: <827d4yoeus.fsf@gmail.com> (message from Pascal Quesseveur on Thu, 30 Jun 2022 08:16:43 +0200)

> 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





  reply	other threads:[~2022-06-30  6:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30  6:16 bug#56317: 28.1; image-convert not working on Windows Pascal Quesseveur
2022-06-30  6:46 ` Eli Zaretskii [this message]
2022-06-30  8:27   ` Pascal Quesseveur
2022-06-30  9:59     ` Eli Zaretskii
2022-06-30 10:19       ` Lars Ingebrigtsen
2022-06-30 10:52         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83edz66434.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=56317@debbugs.gnu.org \
    --cc=pquessev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).