]> git.eshelyaron.com Git - emacs.git/commitdiff
Support for rawrgb images using imagemagick
authorEvgeny Zajcev <lg.zevlg@gmail.com>
Fri, 2 Dec 2016 10:09:31 +0000 (12:09 +0200)
committerEli Zaretskii <eliz@gnu.org>
Fri, 2 Dec 2016 10:09:31 +0000 (12:09 +0200)
* src/image.c (imagemagick_load_image): Set wand size before loading
blob when ':width' and ':height' are provided.

* lisp/image.el (image-format-suffixes): Add 'image/x-rgb'.

lisp/image.el
src/image.c

index 82e0162488984204b89bc87382fd102d32f88368..c34db68a44a6a926ab3e61df06065dbd5b73c35f 100644 (file)
@@ -102,7 +102,7 @@ AUTODETECT can be
            (see `image-type-available-p').")
 
 (defvar image-format-suffixes
-  '((image/x-icon "ico"))
+  '((image/x-rgb "rgb") (image/x-icon "ico"))
   "An alist associating image types with file name suffixes.
 This is used as a hint by the ImageMagick library when detecting
 the type of image data (that does not have an associated file name).
index b5b713c9061646d46db06147e42ab4dbb676ae34..a87dc4d4737f47b1efa1c2a65dc3afc7996865c6 100644 (file)
@@ -8540,6 +8540,14 @@ imagemagick_load_image (struct frame *f, struct image *img,
     status = MagickReadImage (image_wand, filename);
   else
     {
+      Lisp_Object lwidth = image_spec_value (img->spec, QCwidth, NULL);
+      Lisp_Object lheight = image_spec_value (img->spec, QCheight, NULL);
+
+      if (NATNUMP (lwidth) && NATNUMP (lheight))
+       {
+         MagickSetSize (image_wand, XFASTINT (lwidth), XFASTINT (lheight));
+         MagickSetDepth (image_wand, 8);
+       }
       filename_hint = imagemagick_filename_hint (img->spec, hint_buffer);
       MagickSetFilename (image_wand, filename_hint);
       status = MagickReadImageBlob (image_wand, contents, size);