emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0b3f8ca: Support for rawrgb images using imagemagic


From: Eli Zaretskii
Subject: [Emacs-diffs] master 0b3f8ca: Support for rawrgb images using imagemagick
Date: Fri, 2 Dec 2016 10:10:39 +0000 (UTC)

branch: master
commit 0b3f8ca863e7df08e79a935946f7190e595cae2b
Author: Evgeny Zajcev <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Support for rawrgb images using imagemagick
    
    * 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 |    2 +-
 src/image.c   |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/image.el b/lisp/image.el
index 82e0162..c34db68 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -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).
diff --git a/src/image.c b/src/image.c
index b5b713c..a87dc4d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]