diff --git a/MagickCore/pixel-accessor.h b/MagickCore/pixel-accessor.h
index 4aec808..d11ea45 100644
--- a/MagickCore/pixel-accessor.h
+++ b/MagickCore/pixel-accessor.h
@@ -239,6 +239,16 @@
return(pixel[image->channel_map[LPixelChannel].offset]);
}
+static inline MagickRealType GetPixelLuma(const Image *restrict image,
+ const Quantum *restrict pixel)
+{
+ if (image->colorspace == GRAYColorspace)
+ return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]);
+ return(0.21267f*pixel[image->channel_map[RedPixelChannel].offset]+
+ 0.71516f*pixel[image->channel_map[GreenPixelChannel].offset]+
+ 0.07217f*pixel[image->channel_map[BluePixelChannel].offset]); /* Rec709 */
+}
+
static inline MagickRealType GetPixelLuminance(const Image *restrict image,
const Quantum *restrict pixel)
{
@@ -250,16 +260,16 @@
if (image->colorspace == GRAYColorspace)
return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]);
if (image->colorspace != sRGBColorspace)
- return(0.298839f*pixel[image->channel_map[RedPixelChannel].offset]+
- 0.586811f*pixel[image->channel_map[GreenPixelChannel].offset]+
- 0.114350f*pixel[image->channel_map[BluePixelChannel].offset]);
+ return(0.21267f*pixel[image->channel_map[RedPixelChannel].offset]+
+ 0.71516f*pixel[image->channel_map[GreenPixelChannel].offset]+
+ 0.07217f*pixel[image->channel_map[BluePixelChannel].offset]);
red=DecodePixelGamma((MagickRealType)
pixel[image->channel_map[RedPixelChannel].offset]);
green=DecodePixelGamma((MagickRealType)
pixel[image->channel_map[GreenPixelChannel].offset]);
blue=DecodePixelGamma((MagickRealType)
pixel[image->channel_map[BluePixelChannel].offset]);
- return(0.21267f*red+0.71516f*green+0.07217f*blue);
+ return(0.21267f*red+0.71516f*green+0.07217f*blue); /* Rec709 */
}
static inline Quantum GetPixelMagenta(const Image *restrict image,
diff --git a/coders/cip.c b/coders/cip.c
index f9d43fe..7f6ee17 100644
--- a/coders/cip.c
+++ b/coders/cip.c
@@ -245,10 +245,10 @@
for (x=0; x < ((ssize_t) image->columns-3); x+=4)
{
byte=(unsigned char)
- ((((size_t) (4*GetPixelIntensity(image,p+3)/QuantumRange) & 0x03) << 6) |
- (((size_t) (4*GetPixelIntensity(image,p+2)/QuantumRange) & 0x03) << 4) |
- (((size_t) (4*GetPixelIntensity(image,p+1)/QuantumRange) & 0x03) << 2) |
- (((size_t) (4*GetPixelIntensity(image,p+0)/QuantumRange) & 0x03) << 0));
+ ((((size_t) (4*ClampToQuantum(GetPixelLuma(image,p+3))/QuantumRange) & 0x03) << 6) |
+ (((size_t) (4*ClampToQuantum(GetPixelLuma(image,p+2))/QuantumRange) & 0x03) << 4) |
+ (((size_t) (4*ClampToQuantum(GetPixelLuma(image,p+1))/QuantumRange) & 0x03) << 2) |
+ (((size_t) (4*ClampToQuantum(GetPixelLuma(image,p+0))/QuantumRange) & 0x03) << 0));
(void) FormatLocaleString(buffer,MaxTextExtent,"%02x",byte);
(void) WriteBlobString(image,buffer);
p+=4;
@@ -257,10 +257,10 @@
{
i=(ssize_t) image->columns % 4;
byte=(unsigned char)
- ((((size_t) (4*GetPixelIntensity(image,p+MagickMin(i,3))/QuantumRange) & 0x03) << 6) |
- (((size_t) (4*GetPixelIntensity(image,p+MagickMin(i,2))/QuantumRange) & 0x03) << 4) |
- (((size_t) (4*GetPixelIntensity(image,p+MagickMin(i,1))/QuantumRange) & 0x03) << 2) |
- (((size_t) (4*GetPixelIntensity(image,p+MagickMin(i,0))/QuantumRange) & 0x03) << 0));
+ ((((size_t) (4*ClampToQuantum(GetPixelLuma(image,p+MagickMin(i,3)))/QuantumRange) & 0x03) << 6) |
+ (((size_t) (4*ClampToQuantum(GetPixelLuma(image,p+MagickMin(i,2)))/QuantumRange) & 0x03) << 4) |
+ (((size_t) (4*ClampToQuantum(GetPixelLuma(image,p+MagickMin(i,1)))/QuantumRange) & 0x03) << 2) |
+ (((size_t) (4*ClampToQuantum(GetPixelLuma(image,p+MagickMin(i,0)))/QuantumRange) & 0x03) << 0));
(void) FormatLocaleString(buffer,MaxTextExtent,"%02x",~byte);
(void) WriteBlobString(image,buffer);
}
diff --git a/coders/jbig.c b/coders/jbig.c
index b5f330d..33e8fa4 100644
--- a/coders/jbig.c
+++ b/coders/jbig.c
@@ -469,7 +469,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
byte<<=1;
- if (GetPixelIntensity(image,p) < (QuantumRange/2.0))
+ if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x01;
bit++;
if (bit == 8)
diff --git a/coders/jp2.c b/coders/jp2.c
index 3b40e7e..b9cc028 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -1058,7 +1058,7 @@
{
if (number_components == 1)
jas_matrix_setv(pixels[0],x,(jas_seqent_t) ScaleQuantumToAny(
- GetPixelIntensity(image,p),range));
+ ClampToQuantum(GetPixelLuma(image,p)),range));
else
{
jas_matrix_setv(pixels[0],x,(jas_seqent_t) ScaleQuantumToAny(
diff --git a/coders/jpeg.c b/coders/jpeg.c
index ab8b455..319c45e 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -1207,7 +1207,6 @@
}
case JCS_GRAYSCALE:
{
- image->intensity=Rec709LumaPixelIntensityMethod;
(void) SetImageColorspace(image,GRAYColorspace,exception);
break;
}
@@ -2608,32 +2607,30 @@
}
else
if (jpeg_info.in_color_space == JCS_GRAYSCALE)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- image->intensity=Rec709LumaPixelIntensityMethod;
- for (y=0; y < (ssize_t) image->rows; y++)
+ register const Quantum
+ *p;
+
+ register ssize_t
+ x;
+
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
+ break;
+ q=jpeg_pixels;
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- register const Quantum
- *p;
-
- register ssize_t
- x;
-
- p=GetVirtualPixels(image,0,y,image->columns,1,exception);
- if (p == (const Quantum *) NULL)
- break;
- q=jpeg_pixels;
- for (x=0; x < (ssize_t) image->columns; x++)
- {
- *q++=(JSAMPLE) ScaleQuantumToChar(GetPixelIntensity(image,p));
- p+=GetPixelChannels(image);
- }
- (void) jpeg_write_scanlines(&jpeg_info,scanline,1);
- status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
- image->rows);
- if (status == MagickFalse)
- break;
+ *q++=(JSAMPLE) ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(
+ image,p)));
+ p+=GetPixelChannels(image);
}
- }
+ (void) jpeg_write_scanlines(&jpeg_info,scanline,1);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
+ if (status == MagickFalse)
+ break;
+ }
else
for (y=0; y < (ssize_t) image->rows; y++)
{
@@ -2685,7 +2682,8 @@
q=jpeg_pixels;
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=(JSAMPLE) (ScaleQuantumToShort(GetPixelIntensity(image,p)) >> 4);
+ *q++=(JSAMPLE) (ScaleQuantumToShort(ClampToQuantum(GetPixelLuma(
+ image,p))) >> 4);
p+=GetPixelChannels(image);
}
(void) jpeg_write_scanlines(&jpeg_info,scanline,1);
diff --git a/coders/mono.c b/coders/mono.c
index 835c491..58019d6 100644
--- a/coders/mono.c
+++ b/coders/mono.c
@@ -332,11 +332,11 @@
byte>>=1;
if (image->endian == LSBEndian)
{
- if (GetPixelIntensity(image,p) < (QuantumRange/2.0))
+ if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x80;
}
else
- if (GetPixelIntensity(image,p) >= (QuantumRange/2.0))
+ if (GetPixelLuma(image,p) >= (QuantumRange/2.0))
byte|=0x80;
bit++;
if (bit == 8)
diff --git a/coders/otb.c b/coders/otb.c
index 9ae2195..44de67a 100644
--- a/coders/otb.c
+++ b/coders/otb.c
@@ -364,7 +364,7 @@
byte=0;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelIntensity(image,p) < (QuantumRange/2.0))
+ if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x1 << (7-bit);
bit++;
if (bit == 8)
diff --git a/coders/pcl.c b/coders/pcl.c
index 9ce0b7f..d4a5f1d 100644
--- a/coders/pcl.c
+++ b/coders/pcl.c
@@ -872,7 +872,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
byte<<=1;
- if (GetPixelIntensity(image,p) < ((double) QuantumRange/2.0))
+ if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x01;
bit++;
if (bit == 8)
diff --git a/coders/pdf.c b/coders/pdf.c
index d094f88..fed276b 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -1627,7 +1627,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=ScaleQuantumToChar(GetPixelIntensity(image,p));
+ *q++=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
p+=GetPixelChannels(image);
}
if (image->previous == (Image *) NULL)
@@ -1668,8 +1668,8 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- Ascii85Encode(image,ScaleQuantumToChar(
- GetPixelIntensity(image,p)));
+ Ascii85Encode(image,ScaleQuantumToChar(ClampToQuantum(
+ GetPixelLuma(image,p))));
p+=GetPixelChannels(image);
}
if (image->previous == (Image *) NULL)
@@ -2082,7 +2082,8 @@
break;
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
- *q++=ScaleQuantumToChar(GetPixelIntensity(tile_image,p));
+ *q++=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(
+ tile_image,p)));
p+=GetPixelChannels(tile_image);
}
}
@@ -2117,8 +2118,8 @@
break;
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
- Ascii85Encode(image,
- ScaleQuantumToChar(GetPixelIntensity(tile_image,p)));
+ Ascii85Encode(image,ScaleQuantumToChar(ClampToQuantum(
+ GetPixelLuma(tile_image,p))));
p+=GetPixelChannels(tile_image);
}
}
@@ -2357,17 +2358,20 @@
{
if (compression == NoCompression)
{
- Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].red));
- Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].green));
- Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].blue));
+ Ascii85Encode(image,ScaleQuantumToChar(ClampToQuantum(
+ image->colormap[i].red)));
+ Ascii85Encode(image,ScaleQuantumToChar(ClampToQuantum(
+ image->colormap[i].green)));
+ Ascii85Encode(image,ScaleQuantumToChar(ClampToQuantum(
+ image->colormap[i].blue)));
continue;
}
- (void) WriteBlobByte(image,
- ScaleQuantumToChar(image->colormap[i].red));
- (void) WriteBlobByte(image,
- ScaleQuantumToChar(image->colormap[i].green));
- (void) WriteBlobByte(image,
- ScaleQuantumToChar(image->colormap[i].blue));
+ (void) WriteBlobByte(image,ScaleQuantumToChar(
+ ClampToQuantum(image->colormap[i].red)));
+ (void) WriteBlobByte(image,ScaleQuantumToChar(
+ ClampToQuantum(image->colormap[i].green)));
+ (void) WriteBlobByte(image,ScaleQuantumToChar(
+ ClampToQuantum(image->colormap[i].blue)));
}
if (compression == NoCompression)
Ascii85Flush(image);
diff --git a/coders/pnm.c b/coders/pnm.c
index 0fa96fb..184f12c 100644
--- a/coders/pnm.c
+++ b/coders/pnm.c
@@ -1626,7 +1626,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=GetPixelIntensity(image,p);
+ pixel=ClampToQuantum(GetPixelLuma(image,p));
*q++=(unsigned char) (pixel >= (Quantum) (QuantumRange/2) ?
'0' : '1');
*q++=' ';
@@ -1679,7 +1679,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- index=GetPixelIntensity(image,p);
+ index=ClampToQuantum(GetPixelLuma(image,p));
if (image->depth <= 8)
count=(ssize_t) FormatLocaleString(buffer,MaxTextExtent,"%u ",
ScaleQuantumToChar(index));
@@ -1852,7 +1852,8 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsPixelGray(image,p) == MagickFalse)
- pixel=ScaleQuantumToAny(GetPixelIntensity(image,p),range);
+ pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(
+ image,p)),range);
else
{
if (image->depth == 8)
@@ -1867,7 +1868,8 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsPixelGray(image,p) == MagickFalse)
- pixel=ScaleQuantumToAny(GetPixelIntensity(image,p),range);
+ pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(
+ image,p)),range);
else
{
if (image->depth == 16)
@@ -2009,12 +2011,13 @@
if (image->depth <= 8)
for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=ScaleQuantumToAny(GetPixelIntensity(image,p),range);
+ pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(
+ image,p)),range);
q=PopCharPixel((unsigned char) pixel,q);
if (image->alpha_trait == BlendPixelTrait)
{
pixel=(unsigned char) ScaleQuantumToAny(
- GetPixelAlpha(image,p),range);
+ ClampToQuantum(GetPixelAlpha(image,p)),range);
q=PopCharPixel((unsigned char) pixel,q);
}
p+=GetPixelChannels(image);
@@ -2022,7 +2025,8 @@
else
for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=ScaleQuantumToAny(GetPixelIntensity(image,p),range);
+ pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(
+ image,p)),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
if (image->alpha_trait == BlendPixelTrait)
{
diff --git a/coders/ps.c b/coders/ps.c
index 2fc14aa..f91ce7b 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -399,11 +399,11 @@
hex_digits[256];
size_t
- length,
- priority;
+ length;
ssize_t
- count;
+ count,
+ priority;
StringInfo
*profile;
@@ -1063,9 +1063,9 @@
} \
else \
{ \
- q=PopHexPixel(hex_digits,ScaleQuantumToChar(pixel.red),q); \
- q=PopHexPixel(hex_digits,ScaleQuantumToChar(pixel.green),q); \
- q=PopHexPixel(hex_digits,ScaleQuantumToChar(pixel.blue),q); \
+ q=PopHexPixel(hex_digits,ScaleQuantumToChar(ClampToQuantum(pixel.red)),q); \
+ q=PopHexPixel(hex_digits,ScaleQuantumToChar(ClampToQuantum(pixel.green)),q); \
+ q=PopHexPixel(hex_digits,ScaleQuantumToChar(ClampToQuantum(pixel.blue)),q); \
} \
q=PopHexPixel(hex_digits,(size_t) MagickMin(length,0xff),q); \
}
@@ -1650,7 +1650,7 @@
for (x=0; x < (ssize_t) preview_image->columns; x++)
{
byte<<=1;
- pixel=GetPixelIntensity(preview_image,p);
+ pixel=ClampToQuantum(GetPixelLuma(preview_image,p));
if (pixel >= (Quantum) (QuantumRange/2))
byte|=0x01;
bit++;
@@ -1761,7 +1761,7 @@
labels=(char **) RelinquishMagickMemory(labels);
}
(void) ResetMagickMemory(&pixel,0,sizeof(pixel));
- pixel.alpha=(Quantum) TransparentAlpha;
+ pixel.alpha=(MagickRealType) TransparentAlpha;
index=0;
x=0;
if ((image_info->type != TrueColorType) &&
@@ -1787,7 +1787,8 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=(Quantum) ScaleQuantumToChar(GetPixelIntensity(image,p));
+ pixel=(Quantum) ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(
+ image,p)));
q=PopHexPixel(hex_digits,(size_t) pixel,q);
i++;
if ((q-pixels+8) >= 80)
@@ -1838,7 +1839,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
byte<<=1;
- pixel=GetPixelIntensity(image,p);
+ pixel=ClampToQuantum(GetPixelLuma(image,p));
if (pixel >= (Quantum) (QuantumRange/2))
byte|=0x01;
bit++;
@@ -1910,10 +1911,10 @@
length=255;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if ((GetPixelRed(image,p) == pixel.red) &&
- (GetPixelGreen(image,p) == pixel.green) &&
- (GetPixelBlue(image,p) == pixel.blue) &&
- (GetPixelAlpha(image,p) == pixel.alpha) &&
+ if ((GetPixelRed(image,p) == ClampToQuantum(pixel.red)) &&
+ (GetPixelGreen(image,p) == ClampToQuantum(pixel.green)) &&
+ (GetPixelBlue(image,p) == ClampToQuantum(pixel.blue)) &&
+ (GetPixelAlpha(image,p) == ClampToQuantum(pixel.alpha)) &&
(length < 255) && (x < (ssize_t) (image->columns-1)))
length++;
else
@@ -2030,9 +2031,9 @@
for (i=0; i < (ssize_t) image->colors; i++)
{
(void) FormatLocaleString(buffer,MaxTextExtent,"%02X%02X%02X\n",
- ScaleQuantumToChar(image->colormap[i].red),
- ScaleQuantumToChar(image->colormap[i].green),
- ScaleQuantumToChar(image->colormap[i].blue));
+ ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red)),
+ ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green)),
+ ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue)));
(void) WriteBlobString(image,buffer);
}
switch (image_info->compression)
@@ -2073,10 +2074,10 @@
length=0;
}
index=GetPixelIndex(image,p);
- pixel.red=GetPixelRed(image,p);
- pixel.green=GetPixelGreen(image,p);
- pixel.blue=GetPixelBlue(image,p);
- pixel.alpha=GetPixelAlpha(image,p);
+ pixel.red=(MagickRealType) GetPixelRed(image,p);
+ pixel.green=(MagickRealType) GetPixelGreen(image,p);
+ pixel.blue=(MagickRealType) GetPixelBlue(image,p);
+ pixel.alpha=(MagickRealType) GetPixelAlpha(image,p);
p+=GetPixelChannels(image);
}
q=PopHexPixel(hex_digits,(size_t) index,q);
diff --git a/coders/ps2.c b/coders/ps2.c
index 269b9d0..bc9dcda 100644
--- a/coders/ps2.c
+++ b/coders/ps2.c
@@ -791,7 +791,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=ScaleQuantumToChar(GetPixelIntensity(image,p));
+ *q++=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
p+=GetPixelChannels(image);
}
progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
@@ -825,8 +825,8 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- Ascii85Encode(image,ScaleQuantumToChar(
- GetPixelIntensity(image,p)));
+ Ascii85Encode(image,ScaleQuantumToChar(ClampToQuantum(
+ GetPixelLuma(image,p))));
p+=GetPixelChannels(image);
}
progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType)
diff --git a/coders/ps3.c b/coders/ps3.c
index 81ef1bc..c3556de 100644
--- a/coders/ps3.c
+++ b/coders/ps3.c
@@ -347,7 +347,7 @@
if (pack == 1)
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=ScaleQuantumToChar(GetPixelIntensity(image,p));
+ *q++=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
p+=GetPixelChannels(image);
}
else
@@ -357,8 +357,8 @@
{
bit=(unsigned char) 0x00;
if (x < (ssize_t) image->columns)
- bit=(unsigned char) (GetPixelIntensity(image,p) == (Quantum)
- TransparentAlpha ? 0x01 : 0x00);
+ bit=(unsigned char) (GetPixelLuma(image,p) == TransparentAlpha ?
+ 0x01 : 0x00);
code=(code << 1)+bit;
if (((x+1) % pack) == 0)
{
diff --git a/coders/sun.c b/coders/sun.c
index d466d3d..392e86d 100644
--- a/coders/sun.c
+++ b/coders/sun.c
@@ -903,7 +903,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
byte<<=1;
- if (GetPixelIntensity(image,p) < (double) (QuantumRange/2.0))
+ if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x01;
bit++;
if (bit == 8)
diff --git a/coders/tga.c b/coders/tga.c
index 2ff8915..b17962b 100644
--- a/coders/tga.c
+++ b/coders/tga.c
@@ -815,7 +815,7 @@
else
if (targa_info.image_type == TargaMonochrome)
*q++=(unsigned char) ScaleQuantumToChar((ClampToQuantum(
- GetPixelIntensity(image,p))));
+ GetPixelLuma(image,p))));
else
{
*q++=ScaleQuantumToChar(GetPixelBlue(image,p));
diff --git a/coders/viff.c b/coders/viff.c
index ae46bd1..070d687 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -627,7 +627,7 @@
{
for (bit=0; bit < 8; bit++)
{
- if (GetPixelIntensity(image,q) < ((double) QuantumRange/2.0))
+ if (GetPixelLuma(image,q) < (QuantumRange/2.0))
{
quantum=(size_t) GetPixelIndex(image,q);
quantum|=0x01;
@@ -640,7 +640,7 @@
if ((image->columns % 8) != 0)
{
for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)
- if (GetPixelIntensity(image,q) < ((double) QuantumRange/2.0))
+ if (GetPixelLuma(image,q) < (QuantumRange/2.0))
{
quantum=(size_t) GetPixelIndex(image,q);
quantum|=0x01;
@@ -1189,7 +1189,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
byte>>=1;
- if (GetPixelIntensity(image,p) < ((double) QuantumRange/2.0))
+ if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x80;
bit++;
if (bit == 8)
@@ -1223,7 +1223,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- *q++=(unsigned char) GetPixelIntensity(image,p);
+ *q++=(unsigned char) ClampToQuantum(GetPixelLuma(image,p));
p+=GetPixelChannels(image);
}
if (image->previous == (Image *) NULL)
diff --git a/coders/wbmp.c b/coders/wbmp.c
index 44f9be6..3e03b74 100644
--- a/coders/wbmp.c
+++ b/coders/wbmp.c
@@ -396,7 +396,7 @@
byte=0;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelIntensity(image,p) >= ((double) QuantumRange/2.0))
+ if (GetPixelLuma(image,p) >= (QuantumRange/2.0))
byte|=0x1 << (7-bit);
bit++;
if (bit == 8)
diff --git a/coders/wpg.c b/coders/wpg.c
index 9d26732..7d30471 100644
--- a/coders/wpg.c
+++ b/coders/wpg.c
@@ -936,6 +936,9 @@
WPGColorMapRec
WPG_Palette;
+ WPGPSl1Record
+ WPG_Record;
+
int
i,
bpp,
@@ -959,6 +962,7 @@
assert(image_info->signature == MagickSignature);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
+ (void) WPG_Record;
one=1;
image=AcquireImage(image_info,exception);
image->depth=8;
diff --git a/coders/xbm.c b/coders/xbm.c
index 57724ad..1cc444a 100644
--- a/coders/xbm.c
+++ b/coders/xbm.c
@@ -547,7 +547,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
byte>>=1;
- if (GetPixelIntensity(image,p) < (QuantumRange/2))
+ if (GetPixelLuma(image,p) < (QuantumRange/2))
byte|=0x80;
bit++;
if (bit == 8)