unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* DJVU files and ImageMagick
@ 2019-02-02 22:12 Stephen Berman
  2019-02-03 17:12 ` Eli Zaretskii
  2019-02-04  2:30 ` Roland Winkler
  0 siblings, 2 replies; 10+ messages in thread
From: Stephen Berman @ 2019-02-02 22:12 UTC (permalink / raw)
  To: emacs-devel

Should the following change be made?

diff --git a/lisp/image.el b/lisp/image.el
index 3aa3b0aa24..ba75bdf034 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -902,7 +902,7 @@ imagemagick-register-types
       (setq imagemagick--file-regexp re))))
 
 (defcustom imagemagick-types-inhibit
-  '(C HTML HTM INFO M TXT PDF)
+  '(C HTML HTM INFO M TXT PDF DJVU)
   "List of ImageMagick types that should never be treated as images.
 This should be a list of symbols, each of which should be one of
 the ImageMagick types listed by `imagemagick-types'.  The listed

Here's my reason for asking:

If Emacs is built without ImageMagick support and the ddjvu program
(from DjVuLibre) is found, DJVU files are automatically (via
auto-mode-alist) displayed in doc-view-mode.  If Emacs is built with
ImageMagick support (version 6 or 7), image-mode is used to display DJVU
files, because DJVU is one of the images type imagemagick-register-types
assigns to image-mode and adds the corresponding entry to
auto-mode-alist before the entry using doc-view-mode-maybe.

I build Emacs from master with ImageMagick support, but if I try to
visit a DJVU file (e.g. a ca. 200 page book of about 1.5 MB),
immediately almost all my system's RAM is consumed, bringing Emacs to a
halt, so it doesn't display the file, and I can recover the memory only
by killing Emacs.  In contrast, when I open the same DJVU file from the
shell using the ImageMagick 'display' command, it also uses most of the
system memory for a number of seconds but then does display the file and
I can exit the program normally and recover the memory.  (This is with
ImageMagick 7; I also tried it on another system using ImageMagick 6 and
there, but using 'display' from the shell was the same as the Emacs
behavior: almost all memory was consumed and the process had to be
killed.)  Can anyone here visit a comparably sized DJVU file in Emacs
built with ImageMagick and have it displayed?  If so, maybe my system
just lacks sufficient memory (it has 4GB RAM + 1 GB swap) -- though that
doesn't explain the difference between 'display' and Emacs+ImageMagick
with ImageMagick 7.

I can prevent Emacs from using ImageMagick with DJVU by customizing
either imagemagick-types-inhibit or imagemagick-enabled-types, but if
this is a general issue, maybe the default value of one of these should
be changed to prevent using ImageMagick with DJVU files.  I see that by
default, PDF is in both lists, whereas DJVU is only in the latter (which
comes from imagemagick-types according to what ImageMagick itself claims
to support).  And indeed, when I try to open a PDF file from the shell
with 'display', the process aborts, so I infer that's why PDF was added
to imagemagick-types-inhibit, and hence, if the problem with DJVU I see
is general, the same thing should be done for this file type (i.e., the
above patch).  (I normally view DJVU files in Emacs using the
djvu package from ELPA, which like doc-view uses DjVuLibre programs, not
ImageMagick, so it doesn't have this issue; but if I use C-x C-f or
Dired to visit a DJVU file, I get the problem.)

If this is just a problem of too little memory, an alternative to
changing the default value of imagemagick-types-inhibit is to add a note
to etc/PROBLEMS suggesting to customize this user option.

Steve Berman



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

end of thread, other threads:[~2019-02-06 16:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-02 22:12 DJVU files and ImageMagick Stephen Berman
2019-02-03 17:12 ` Eli Zaretskii
2019-02-03 21:48   ` joakim
2019-02-04  2:30 ` Roland Winkler
2019-02-04  7:18   ` Colin Baxter
2019-02-04 17:34   ` Stephen Berman
2019-02-06  3:53     ` Roland Winkler
2019-02-06  5:30       ` Drew Adams
2019-02-06 16:35         ` Roland Winkler
2019-02-06  8:45       ` Stephen Berman

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