aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2019-09-29 10:09:56 +0300
committerEli Zaretskii2019-09-29 10:09:56 +0300
commit82c79220f58caa8ee6b78c8704aa97191c2352c7 (patch)
tree2b648d9ce6ab47a0e7df1687616fbde59719a22e
parent8b5e92921ed9748e13433acf176b03488bc8bedb (diff)
downloademacs-82c79220f58caa8ee6b78c8704aa97191c2352c7.tar.gz
emacs-82c79220f58caa8ee6b78c8704aa97191c2352c7.zip
Improve documentation of image conversion feature
* lisp/image/image-converter.el (image-converter) (image-convert-p, image-convert): * lisp/image.el (convert-images-externally): * etc/NEWS: * doc/lispref/display.texi (Defining Images): Fix recently added documentation.
-rw-r--r--doc/lispref/display.texi3
-rw-r--r--etc/NEWS10
-rw-r--r--lisp/image.el10
-rw-r--r--lisp/image/image-converter.el13
4 files changed, 20 insertions, 16 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index ec288b1c47d..a661eca13f0 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -6049,7 +6049,8 @@ If Emacs doesn't have native support for the image format in question,
6049and @code{convert-images-externally} is non-@code{nil}, Emacs will try 6049and @code{convert-images-externally} is non-@code{nil}, Emacs will try
6050to determine whether there are external utilities that can be used to 6050to determine whether there are external utilities that can be used to
6051transform the image in question to @acronym{PNG} before displaying. 6051transform the image in question to @acronym{PNG} before displaying.
6052GraphicsMagick, ImageMagick and ffmpeg are currently supported. 6052GraphicsMagick, ImageMagick and @command{ffmpeg} are currently
6053supported for image conversions.
6053 6054
6054The function returns @code{nil} if images of this type are not 6055The function returns @code{nil} if images of this type are not
6055supported. Otherwise it returns an image descriptor. 6056supported. Otherwise it returns an image descriptor.
diff --git a/etc/NEWS b/etc/NEWS
index 677b710e223..3d8480cb461 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2657,11 +2657,11 @@ data about creation times and orientation and the like.
2657functions. 2657functions.
2658 2658
2659*** New library image-converter. 2659*** New library image-converter.
2660To view exotic image formats that Emacs doesn't have native support 2660If you need to view exotic image formats for which Emacs doesn't have
2661for, the new 'convert-images-externally' variable can be set to t. If 2661native support, customize the new variable 'convert-images-externally'
2662the system has GraphicsMagick, ImageMagick or ffmpeg installed, it 2662to t. If your system has GraphicsMagick, ImageMagick or 'ffmpeg'
2663will be used to convert images automatically before displaying with 2663installed, they will then be used to convert images automatically
2664'create-image'. 2664before displaying them.
2665 2665
2666*** 'image-mode' now uses this library to automatically rotate images 2666*** 'image-mode' now uses this library to automatically rotate images
2667according to the orientation in the Exif data, if any. 2667according to the orientation in the Exif data, if any.
diff --git a/lisp/image.el b/lisp/image.el
index 3f953e65ae8..07ffefcbc5b 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -143,11 +143,11 @@ based on the font pixel size."
143 143
144(defcustom convert-images-externally nil 144(defcustom convert-images-externally nil
145 "If non-nil, `create-image' will use external converters for exotic formats. 145 "If non-nil, `create-image' will use external converters for exotic formats.
146Emacs handles most of the common image formats (JPEG, PNG, GIF 146Emacs handles most of the common image formats (SVG, JPEG, PNG, GIF
147and so on) internally, but images that doesn't have native 147and some others) internally, but images that don't have native
148support in Emacs can still be displayed by Emacs if external 148support in Emacs can still be displayed if an external conversion
149conversion programs (like ImageMagick \"convert\", GraphicsMagick 149program (like ImageMagick \"convert\", GraphicsMagick \"gm\"
150\"gm\" or \"ffmpeg\") are installed." 150or \"ffmpeg\") is installed."
151 :type 'bool 151 :type 'bool
152 :version "27.1") 152 :version "27.1")
153 153
diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el
index f485c348426..25b49ff103b 100644
--- a/lisp/image/image-converter.el
+++ b/lisp/image/image-converter.el
@@ -41,8 +41,11 @@ conversion programs (like ImageMagick \"convert\", GraphicsMagick
41 :version "27.1") 41 :version "27.1")
42 42
43(defcustom image-converter nil 43(defcustom image-converter nil
44 "What external converter to use. 44 "Type of the external image converter to use.
45`imagemagick', `graphicsmagick' and `ffmpeg' are supported." 45The value should a symbol, either `imagemagick', `graphicsmagick',
46or `ffmpeg'.
47If nil, Emacs will try to find one of the supported converters
48installed on the system."
46 :group 'image 49 :group 'image
47 :type 'symbol 50 :type 'symbol
48 :version "27.1") 51 :version "27.1")
@@ -57,7 +60,7 @@ conversion programs (like ImageMagick \"convert\", GraphicsMagick
57 "List of supported image converters to try.") 60 "List of supported image converters to try.")
58 61
59(defun image-convert-p (file) 62(defun image-convert-p (file)
60 "Return `image-convert' if FILE can be converted." 63 "Return `image-convert' if FILE is an image file that can be converted."
61 ;; Find an installed image converter. 64 ;; Find an installed image converter.
62 (unless image-converter 65 (unless image-converter
63 (image-converter--find-converter)) 66 (image-converter--find-converter))
@@ -66,7 +69,7 @@ conversion programs (like ImageMagick \"convert\", GraphicsMagick
66 'image-convert)) 69 'image-convert))
67 70
68(defun image-convert (image) 71(defun image-convert (image)
69 "Convert IMAGE to a format Emacs can display. 72 "Convert IMAGE file to the PNG format.
70IMAGE can either be a file name, which will make the return value 73IMAGE can either be a file name, which will make the return value
71a string with the image data. It can also be an image object as 74a string with the image data. It can also be an image object as
72returned by `create-image'. If so, it has to be an image object 75returned by `create-image'. If so, it has to be an image object
@@ -75,7 +78,7 @@ where created with DATA-P nil (i.e., it has to refer to a file)."
75 (unless image-converter 78 (unless image-converter
76 (image-converter--find-converter)) 79 (image-converter--find-converter))
77 (unless image-converter 80 (unless image-converter
78 (error "No external image converters installed")) 81 (error "No external image converters available"))
79 (when (and (listp image) 82 (when (and (listp image)
80 (not (plist-get (cdr image) :file))) 83 (not (plist-get (cdr image) :file)))
81 (error "Only images that refer to files can be converted")) 84 (error "Only images that refer to files can be converted"))