diff options
| author | Glenn Morris | 2014-01-22 00:30:00 -0800 |
|---|---|---|
| committer | Glenn Morris | 2014-01-22 00:30:00 -0800 |
| commit | 7b997b14589f85f2987f45a99abb8cfa4cd8d390 (patch) | |
| tree | 8cd0f5d4c3a601deec6965fa20882d8bbfe420f0 | |
| parent | 44e76f9dd1ab4b37eef3702912a1e20f00353868 (diff) | |
| download | emacs-7b997b14589f85f2987f45a99abb8cfa4cd8d390.tar.gz emacs-7b997b14589f85f2987f45a99abb8cfa4cd8d390.zip | |
Some doc for image-format-suffixes
* doc/lispref/display.texi (ImageMagick Images):
Expand on image-format-suffixes.
* lisp/image.el (image-format-suffixes): Doc fix.
* etc/NEWS: Related markup.
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 31 | ||||
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/image.el | 10 |
5 files changed, 36 insertions, 19 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 78bc55af941..f5b2425581b 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-01-22 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * display.texi (ImageMagick Images): Expand on image-format-suffixes. | ||
| 4 | |||
| 1 | 2014-01-20 Glenn Morris <rgm@gnu.org> | 5 | 2014-01-20 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * hash.texi (Other Hash): Do not mention subr-x.el functions; | 7 | * hash.texi (Other Hash): Do not mention subr-x.el functions; |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index f42d02e056f..9123e940e08 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -4690,6 +4690,16 @@ should never be rendered using ImageMagick, regardless of the value of | |||
| 4690 | ImageMagick entirely. | 4690 | ImageMagick entirely. |
| 4691 | @end defopt | 4691 | @end defopt |
| 4692 | 4692 | ||
| 4693 | @defvar image-format-suffixes | ||
| 4694 | This variable is an alist mapping image types to file name extensions. | ||
| 4695 | Emacs uses this in conjunction with the @code{:format} image property | ||
| 4696 | (see below) to give a hint to the ImageMagick library as to the type | ||
| 4697 | of an image. Each element has the form @code{(@var{type} | ||
| 4698 | @var{extension})}, where @var{type} is a symbol specifying an image | ||
| 4699 | content-type, and @var{extension} is a string that specifies the | ||
| 4700 | associated file name extension. | ||
| 4701 | @end defvar | ||
| 4702 | |||
| 4693 | Images loaded with ImageMagick support the following additional | 4703 | Images loaded with ImageMagick support the following additional |
| 4694 | image descriptor properties: | 4704 | image descriptor properties: |
| 4695 | 4705 | ||
| @@ -4700,13 +4710,13 @@ color, which is used as the image's background color if the image | |||
| 4700 | supports transparency. If the value is @code{nil}, it defaults to the | 4710 | supports transparency. If the value is @code{nil}, it defaults to the |
| 4701 | frame's background color. | 4711 | frame's background color. |
| 4702 | 4712 | ||
| 4703 | @item :width, :height | 4713 | @item :width @var{width}, :height @var{height} |
| 4704 | The @code{:width} and @code{:height} keywords are used for scaling the | 4714 | The @code{:width} and @code{:height} keywords are used for scaling the |
| 4705 | image. If only one of them is specified, the other one will be | 4715 | image. If only one of them is specified, the other one will be |
| 4706 | calculated so as to preserve the aspect ratio. If both are specified, | 4716 | calculated so as to preserve the aspect ratio. If both are specified, |
| 4707 | aspect ratio may not be preserved. | 4717 | aspect ratio may not be preserved. |
| 4708 | 4718 | ||
| 4709 | @item :max-width, :max-height | 4719 | @item :max-width @var{max-width}, :max-height @var{max-height} |
| 4710 | The @code{:max-width} and @code{:max-height} keywords are used for | 4720 | The @code{:max-width} and @code{:max-height} keywords are used for |
| 4711 | scaling if the size of the image of the image exceeds these values. | 4721 | scaling if the size of the image of the image exceeds these values. |
| 4712 | If @code{:width} is set it will have precedence over @code{max-width}, | 4722 | If @code{:width} is set it will have precedence over @code{max-width}, |
| @@ -4715,19 +4725,16 @@ and if @code{:height} is set it will have precedence over | |||
| 4715 | wish. @code{:max-width} and @code{:max-height} will always preserve | 4725 | wish. @code{:max-width} and @code{:max-height} will always preserve |
| 4716 | the aspect ratio. | 4726 | the aspect ratio. |
| 4717 | 4727 | ||
| 4718 | @c FIXME: ':format-type' or ':format'? --xfq | 4728 | @item :format @var{type} |
| 4719 | @item :format | 4729 | The value, @var{type}, should be a symbol specifying the type of the |
| 4720 | ImageMagick tries to auto-detect the image type, but it isn't always | 4730 | image data, as found in @code{image-format-suffixes}. This is used |
| 4721 | able to. By using @code{:format-type}, we can give ImageMagick a hint | 4731 | when the image does not have an associated file name, to provide a |
| 4722 | to try to help it. It's used in conjunction with the | 4732 | hint to ImageMagick to help it detect the image type. |
| 4723 | @code{image-format-suffixes} variable, which provides a mapping from | ||
| 4724 | content types to file name suffixes. This is then given to | ||
| 4725 | ImageMagick as a file name hint. | ||
| 4726 | 4733 | ||
| 4727 | @item :rotation | 4734 | @item :rotation @var{angle} |
| 4728 | Specifies a rotation angle in degrees. | 4735 | Specifies a rotation angle in degrees. |
| 4729 | 4736 | ||
| 4730 | @item :index | 4737 | @item :index @var{frame} |
| 4731 | @c Doesn't work: http://debbugs.gnu.org/7978 | 4738 | @c Doesn't work: http://debbugs.gnu.org/7978 |
| 4732 | @xref{Multi-Frame Images}. | 4739 | @xref{Multi-Frame Images}. |
| 4733 | @end table | 4740 | @end table |
| @@ -175,9 +175,11 @@ Use `C-h C-\' (`describe-input-method') instead. | |||
| 175 | +++ | 175 | +++ |
| 176 | *** ImageMagick images now support the :max-width and :max-height keywords. | 176 | *** ImageMagick images now support the :max-width and :max-height keywords. |
| 177 | 177 | ||
| 178 | *** Some data types aren't auto-detected by ImageMagick. | 178 | +++ |
| 179 | Adding :format to `create-image' may help if the content type is in | 179 | *** When using `create-image' with image data, you can pass a :format |
| 180 | the new variable `image-format-suffixes'. | 180 | attribute (via the property-list argument) in order to help |
| 181 | ImageMagick detect the image type. The value should be a MIME | ||
| 182 | content-type that is found in the new variable `image-format-suffixes'. | ||
| 181 | 183 | ||
| 182 | ** Frame and window changes | 184 | ** Frame and window changes |
| 183 | 185 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 106e12e88b7..974cd2223ef 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2014-01-22 Glenn Morris <rgm@gnu.org> | 1 | 2014-01-22 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * image.el (image-format-suffixes): Doc fix. | ||
| 4 | |||
| 3 | * international/quail.el (quail-define-package): Doc fix. | 5 | * international/quail.el (quail-define-package): Doc fix. |
| 4 | 6 | ||
| 5 | * emacs-lisp/authors.el (authors-valid-file-names): | 7 | * emacs-lisp/authors.el (authors-valid-file-names): |
diff --git a/lisp/image.el b/lisp/image.el index dec6991666a..d16fe4fb0ba 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -104,11 +104,13 @@ AUTODETECT can be | |||
| 104 | 104 | ||
| 105 | (defvar image-format-suffixes | 105 | (defvar image-format-suffixes |
| 106 | '((image/x-icon "ico")) | 106 | '((image/x-icon "ico")) |
| 107 | "Alist of MIME Content-Type headers to file name suffixes. | 107 | "An alist associating image types with file name suffixes. |
| 108 | This is used as a hint by the ImageMagick library when detecting | 108 | This is used as a hint by the ImageMagick library when detecting |
| 109 | image types. If `create-image' is called with a :format | 109 | the type of image data (that does not have an associated file name). |
| 110 | matching found in this alist, the ImageMagick library will be | 110 | Each element has the form (MIME-CONTENT-TYPE EXTENSION). |
| 111 | told that the data would have this suffix if saved to a file.") | 111 | If `create-image' is called with a :format attribute whose value |
| 112 | equals a content-type found in this list, the ImageMagick library is | ||
| 113 | told that the data would have the associated suffix if saved to a file.") | ||
| 112 | 114 | ||
| 113 | (defcustom image-load-path | 115 | (defcustom image-load-path |
| 114 | (list (file-name-as-directory (expand-file-name "images" data-directory)) | 116 | (list (file-name-as-directory (expand-file-name "images" data-directory)) |