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'.
This commit is contained in:
Evgeny Zajcev 2016-12-02 12:09:31 +02:00 committed by Eli Zaretskii
parent b3ff982a99
commit 0b3f8ca863
2 changed files with 9 additions and 1 deletions

View 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).

View 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);