aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorPaul Eggert <[email protected]>2014-05-21 12:51:58 -0700
committerPaul Eggert <[email protected]>2014-05-21 12:51:58 -0700
commit6c596cb2ea3075afab8812f45803683be2949323 (patch)
tree18018a6d0947dff4b272e5e19f96367ba0fcff75 /src/image.c
parent254b7645f30f67abd00b773f2b0eac63d4c382dd (diff)
Don't assume that ImageMagick uses a 16-bit quantum.
* image.c (imagemagick_load_image): Port to hosts that do not use a 16-bit quantum, i.e., QuantumRange does not equal 65535. Fixes: debbugs:17519
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/image.c b/src/image.c
index 047f751750..f7c3ef5256 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8368,6 +8368,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
#endif /* HAVE_MAGICKEXPORTIMAGEPIXELS */
{
size_t image_height;
+ double color_scale = 65535.0 / QuantumRange;
/* Try to create a x pixmap to hold the imagemagick pixmap. */
if (!image_create_x_image_and_pixmap (f, img, width, height, 0,
@@ -8408,9 +8409,9 @@ imagemagick_load_image (struct frame *f, struct image *img,
PixelGetMagickColor (pixels[x], &pixel);
XPutPixel (ximg, x, y,
lookup_rgb_color (f,
- pixel.red,
- pixel.green,
- pixel.blue));
+ color_scale * pixel.red,
+ color_scale * pixel.green,
+ color_scale * pixel.blue));
}
}
DestroyPixelIterator (iterator);