diff options
| author | Eli Zaretskii | 2019-09-29 10:09:56 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-09-29 10:09:56 +0300 |
| commit | 82c79220f58caa8ee6b78c8704aa97191c2352c7 (patch) | |
| tree | 2b648d9ce6ab47a0e7df1687616fbde59719a22e | |
| parent | 8b5e92921ed9748e13433acf176b03488bc8bedb (diff) | |
| download | emacs-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.texi | 3 | ||||
| -rw-r--r-- | etc/NEWS | 10 | ||||
| -rw-r--r-- | lisp/image.el | 10 | ||||
| -rw-r--r-- | lisp/image/image-converter.el | 13 |
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, | |||
| 6049 | and @code{convert-images-externally} is non-@code{nil}, Emacs will try | 6049 | and @code{convert-images-externally} is non-@code{nil}, Emacs will try |
| 6050 | to determine whether there are external utilities that can be used to | 6050 | to determine whether there are external utilities that can be used to |
| 6051 | transform the image in question to @acronym{PNG} before displaying. | 6051 | transform the image in question to @acronym{PNG} before displaying. |
| 6052 | GraphicsMagick, ImageMagick and ffmpeg are currently supported. | 6052 | GraphicsMagick, ImageMagick and @command{ffmpeg} are currently |
| 6053 | supported for image conversions. | ||
| 6053 | 6054 | ||
| 6054 | The function returns @code{nil} if images of this type are not | 6055 | The function returns @code{nil} if images of this type are not |
| 6055 | supported. Otherwise it returns an image descriptor. | 6056 | supported. Otherwise it returns an image descriptor. |
| @@ -2657,11 +2657,11 @@ data about creation times and orientation and the like. | |||
| 2657 | functions. | 2657 | functions. |
| 2658 | 2658 | ||
| 2659 | *** New library image-converter. | 2659 | *** New library image-converter. |
| 2660 | To view exotic image formats that Emacs doesn't have native support | 2660 | If you need to view exotic image formats for which Emacs doesn't have |
| 2661 | for, the new 'convert-images-externally' variable can be set to t. If | 2661 | native support, customize the new variable 'convert-images-externally' |
| 2662 | the system has GraphicsMagick, ImageMagick or ffmpeg installed, it | 2662 | to t. If your system has GraphicsMagick, ImageMagick or 'ffmpeg' |
| 2663 | will be used to convert images automatically before displaying with | 2663 | installed, they will then be used to convert images automatically |
| 2664 | 'create-image'. | 2664 | before 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 |
| 2667 | according to the orientation in the Exif data, if any. | 2667 | according 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. |
| 146 | Emacs handles most of the common image formats (JPEG, PNG, GIF | 146 | Emacs handles most of the common image formats (SVG, JPEG, PNG, GIF |
| 147 | and so on) internally, but images that doesn't have native | 147 | and some others) internally, but images that don't have native |
| 148 | support in Emacs can still be displayed by Emacs if external | 148 | support in Emacs can still be displayed if an external conversion |
| 149 | conversion programs (like ImageMagick \"convert\", GraphicsMagick | 149 | program (like ImageMagick \"convert\", GraphicsMagick \"gm\" |
| 150 | \"gm\" or \"ffmpeg\") are installed." | 150 | or \"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." | 45 | The value should a symbol, either `imagemagick', `graphicsmagick', |
| 46 | or `ffmpeg'. | ||
| 47 | If nil, Emacs will try to find one of the supported converters | ||
| 48 | installed 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. |
| 70 | IMAGE can either be a file name, which will make the return value | 73 | IMAGE can either be a file name, which will make the return value |
| 71 | a string with the image data. It can also be an image object as | 74 | a string with the image data. It can also be an image object as |
| 72 | returned by `create-image'. If so, it has to be an image object | 75 | returned 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")) |