30 lines
1.3 KiB
Diff
30 lines
1.3 KiB
Diff
From 3e10f7c3c9f0394dfd6ebd372bc34a172dabc8ff Mon Sep 17 00:00:00 2001
|
|
From: Cristy <urban-warrior@imagemagick.org>
|
|
Date: Thu, 3 Oct 2019 18:24:44 -0400
|
|
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1713
|
|
|
|
---
|
|
coders/hdr.c | 9 ++++++---
|
|
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/coders/hdr.c b/coders/hdr.c
|
|
index ab02f8e52..77e3c6336 100644
|
|
--- a/coders/hdr.c
|
|
+++ b/coders/hdr.c
|
|
@@ -786,9 +786,12 @@ static MagickBooleanType WriteHDRImage(const ImageInfo *image_info,Image *image)
|
|
exponent;
|
|
|
|
gamma=frexp(gamma,&exponent)*256.0/gamma;
|
|
- pixel[0]=(unsigned char) (gamma*QuantumScale*GetPixelRed(p));
|
|
- pixel[1]=(unsigned char) (gamma*QuantumScale*GetPixelGreen(p));
|
|
- pixel[2]=(unsigned char) (gamma*QuantumScale*GetPixelBlue(p));
|
|
+ if (GetPixelRed(p) > 0)
|
|
+ pixel[0]=(unsigned char) (gamma*QuantumScale*GetPixelRed(p));
|
|
+ if (GetPixelGreen(p) > 0)
|
|
+ pixel[1]=(unsigned char) (gamma*QuantumScale*GetPixelGreen(p));
|
|
+ if (GetPixelBlue(p) > 0)
|
|
+ pixel[2]=(unsigned char) (gamma*QuantumScale*GetPixelBlue(p));
|
|
pixel[3]=(unsigned char) (exponent+128);
|
|
}
|
|
if ((image->columns >= 8) && (image->columns <= 0x7ffff))
|