unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56317: 28.1; image-convert not working on Windows
@ 2022-06-30  6:16 Pascal Quesseveur
  2022-06-30  6:46 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Pascal Quesseveur @ 2022-06-30  6:16 UTC (permalink / raw)
  To: 56317


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
...


In GNU Emacs 28.1 (build 2, x86_64-w64-mingw32)
 of 2022-04-21 built on AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Pro (v10.0.2009.19044.1766)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation
 --without-compress-install CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES
NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS XPM ZLIB

(NATIVE_COMP present but libgccjit not available)

Important settings:
  value of $LANG: FRA
  locale-coding-system: cp1252

Major mode: Article

Minor modes in effect:
  display-time-mode: t
  shell-dirtrack-mode: t
  icomplete-mode: t
  auto-image-file-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
c:/Users/Public/emacs-site/lisp/bbdb/bbdb-vcard-export hides c:/Users/Public/emacs-site/lisp/utils/bbdb-vcard-export
c:/Users/Public/emacs-site/lisp/utils/wdired hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/wdired
c:/Users/Public/emacs-site/lisp/utils/ls-lisp hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/ls-lisp
c:/Users/Public/emacs-site/lisp/utils/iimage hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/iimage
c:/Users/Public/emacs-site/lisp/utils/calculator hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/calculator
c:/Users/Public/emacs-site/lisp/utils/table hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/textmodes/table
c:/Users/Public/emacs-site/lisp/remember/remember hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/textmodes/remember
c:/Users/Public/emacs-site/lisp/utils/rlogin hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/net/rlogin
c:/Users/Public/emacs-site/lisp/dictionary-1.8.7/dictionary hides c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/net/dictionary

Features:
(shadow warnings emacsbug url-http url-gw url-auth url-queue url-cache
flow-fill smerge-mode diff diff-mode jka-compr canlock bookmark
shr-color color gnus-fun mule-util mm-archive sort smiley gnus-cite
gnus-bcklg gnus-async qp gnus-ml time-stamp gnus-topic nndraft nnmh
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg nnml
utf-7 gnutls nnfolder cl-extra help-mode gnus-cache network-stream nsm
nntp emms-info-libtag emms-player-vlc emms-player-mpv
emms-player-mplayer emms-playlist-limit emms-volume
emms-volume-mixerctl emms-volume-pulse emms-volume-amixer emms-i18n
emms-stream-info emms-mode-line-icon emms-playlist-sort
emms-last-played emms-playing-time emms-player-simple emms-streams
emms-show-all emms-tag-editor emms-mark emms-mode-line
emms-info-ogginfo emms-info-mp3info emms-info later-do
emms-playlist-mode emms-source-playlist emms-source-file locate
music-list music-album emms-setup emms emms-compat time
highlight-current-line color-theme smtpmail sendmail tumblesocks
tumblesocks-view tumblesocks-compose markdown-mode noutline outline
htmlize tumblesocks-user tumblesocks-api oauth sasl sasl-anonymous
sasl-login sasl-plain hex-util hmac-sha1 plantuml-mode pcase dash
thingatpt html2help footnote rx muse-odf muse-xml muse-help
muse-bbcode muse-blosxom muse-wiki muse-texinfo texnfo-upd texinfo
texinfo-loaddefs muse-latex muse-html muse-docbook muse-xml-common
cus-edit pp cus-load muse-publish muse-project muse-protocols info
muse-regexps muse muse-nested-tags muse-mode u-vm-color
org-import-icalendar icalendar diary-lib diary-loaddefs bbdb-gnus
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr
kinsoku svg dom browse-url gnus-group gnus-undo gnus-start gnus-dbus
dbus xml gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
gnus-spec gnus-int gnus-range gnus-win gnus nnheader bbdb-snarf
mail-extr bbdb-com message rmc puny dired-explore dired-sort-menu
wid-edit acid dired-arc file-op dired-x dired dired-loaddefs rfc822
mml mml-sec gnus-util rmail rmail-loaddefs mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader
bbdb-vcard-export bbdb-export bbdb-autoloads bbdb timezone tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
pcomplete parse-time iso8601 time-date format-spec which idb gud
easy-mmode compile text-property-search comint ansi-color ring
qproj-opascal jsee javadoc-lookup ido jserial jswat qproj-java jdok
tempo url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse auth-source eieio eieio-core
eieio-loaddefs password-cache json subr-x map seq byte-opt bytecomp
byte-compile cconv url-vars mailcap xml-parse doxymacs qproj-cpp qproj
server dos-indent generic generic-x cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs lunar solar
cal-dst cal-tex cal-iso cal-menu calendar cal-loaddefs epa-file epa
derived epg rfc6068 epg-config ps-mule ipp cl-seq cl-macs cl gv
printing ps-print ps-print-loaddefs ps-def lpr icomplete advice
image-file image-converter edmacro kmacro cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads
w32notify w32 lcms2 multi-tty make-network-process native-compile
emacs)

Memory information:
((conses 16 612203 48811)
 (symbols 48 34766 4)
 (strings 32 168214 6161)
 (string-bytes 1 6000875)
 (vectors 16 53658)
 (vector-slots 8 1338327 123618)
 (floats 8 1189 350)
 (intervals 56 1366 188)
 (buffers 992 36))

-- 
Pascal Quesseveur





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#56317: 28.1; image-convert not working on Windows
  2022-06-30  6:16 bug#56317: 28.1; image-convert not working on Windows Pascal Quesseveur
@ 2022-06-30  6:46 ` Eli Zaretskii
  2022-06-30  8:27   ` Pascal Quesseveur
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-06-30  6:46 UTC (permalink / raw)
  To: Pascal Quesseveur; +Cc: 56317

> 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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#56317: 28.1; image-convert not working on Windows
  2022-06-30  6:46 ` Eli Zaretskii
@ 2022-06-30  8:27   ` Pascal Quesseveur
  2022-06-30  9:59     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Pascal Quesseveur @ 2022-06-30  8:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 56317

>"EZ" == Eli Zaretskii <eliz@gnu.org> writes:

  EZ> Thanks.  Please try the patch below:

  Thanks. Is is working fine.

  I have 2 other remrks about image-converter:

  - it would be better to use 'magick convert' instead of 'convert' to
    avoid ambiguities at least under windows,
  - bmp images cannot be processed by an external converter as bmp is
    listed in image-type-file-name-regexps. Except the bmp images are
    not displayed by the new method on Windows

  I think I have to send 2 new bug reports.


-- 
Pascal Quesseveur
pquessev@gmail.com





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#56317: 28.1; image-convert not working on Windows
  2022-06-30  8:27   ` Pascal Quesseveur
@ 2022-06-30  9:59     ` Eli Zaretskii
  2022-06-30 10:19       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-06-30  9:59 UTC (permalink / raw)
  To: pquessev, Lars Ingebrigtsen; +Cc: 56317

> From: Pascal Quesseveur <pquessev@gmail.com>
> Cc: 56317@debbugs.gnu.org
> Date: Thu, 30 Jun 2022 10:27:27 +0200
> 
> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
> 
>   EZ> Thanks.  Please try the patch below:
> 
>   Thanks. Is is working fine.

Thanks for testing.

Lars, WDYT about including this in Emacs 28.2?  If you think it's safe
enough, would you mind testing the patch on GNU/Linux?  I don't have
access to any systems with ImageMagick installed.

(In the final commit, I will make the same change in the ffmpeg
method.)

>   I have 2 other remrks about image-converter:
> 
>   - it would be better to use 'magick convert' instead of 'convert' to
>     avoid ambiguities at least under windows,

I don't understand: the actual method invoked in that case is
image-converter--convert-magick.  The image-converter--convert one (if
that's what you mean) is a generic name (see that cl-defmethod?).  So
what is not right here?

>   - bmp images cannot be processed by an external converter as bmp is
>     listed in image-type-file-name-regexps. Except the bmp images are
>     not displayed by the new method on Windows

Emacs 29 can display BMP images on Windows natively, so that problem
is already taken care of, just not in Emacs 28.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#56317: 28.1; image-convert not working on Windows
  2022-06-30  9:59     ` Eli Zaretskii
@ 2022-06-30 10:19       ` Lars Ingebrigtsen
  2022-06-30 10:52         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-30 10:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pquessev, 56317

Eli Zaretskii <eliz@gnu.org> writes:

> Lars, WDYT about including this in Emacs 28.2?  If you think it's safe
> enough, would you mind testing the patch on GNU/Linux?  I don't have
> access to any systems with ImageMagick installed.

It looks safe enough for 28.2 to me.

I've now tried your patch in Emacs 28 in Debian/bookworm, and enabled
conversion using imagemagick, and it works fine for me (testing on a
webp image).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#56317: 28.1; image-convert not working on Windows
  2022-06-30 10:19       ` Lars Ingebrigtsen
@ 2022-06-30 10:52         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2022-06-30 10:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: pquessev, 56317-done

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: pquessev@gmail.com,  56317@debbugs.gnu.org
> Date: Thu, 30 Jun 2022 12:19:49 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Lars, WDYT about including this in Emacs 28.2?  If you think it's safe
> > enough, would you mind testing the patch on GNU/Linux?  I don't have
> > access to any systems with ImageMagick installed.
> 
> It looks safe enough for 28.2 to me.
> 
> I've now tried your patch in Emacs 28 in Debian/bookworm, and enabled
> conversion using imagemagick, and it works fine for me (testing on a
> webp image).

Thanks, installed on the emacs-28 branch, and closing the bug.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-30 10:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30  6:16 bug#56317: 28.1; image-convert not working on Windows Pascal Quesseveur
2022-06-30  6:46 ` Eli Zaretskii
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

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).