diff --git a/coders/aai.c b/coders/aai.c
index 6a4f83b..5b49257 100644
--- a/coders/aai.c
+++ b/coders/aai.c
@@ -172,9 +172,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
if (*p == 254)
*p=255;
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p));
diff --git a/coders/avs.c b/coders/avs.c
index dac7038..ab182df 100644
--- a/coders/avs.c
+++ b/coders/avs.c
@@ -173,9 +173,9 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p++));
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
if (q->opacity != OpaqueOpacity)
image->matte=MagickTrue;
q++;
diff --git a/coders/bmp.c b/coders/bmp.c
index e9d3396..7c3c13a 100644
--- a/coders/bmp.c
+++ b/coders/bmp.c
@@ -1202,9 +1202,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
SetOpacityPixelComponent(q,OpaqueOpacity);
q++;
}
diff --git a/coders/dib.c b/coders/dib.c
index c298bdf..2dac35d 100644
--- a/coders/dib.c
+++ b/coders/dib.c
@@ -829,11 +829,11 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
if (image->matte != MagickFalse)
- q->opacity=ScaleCharToQuantum(*p++);
+ SetOpacityPixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
diff --git a/coders/fits.c b/coders/fits.c
index 93a7d20..8434e0a 100644
--- a/coders/fits.c
+++ b/coders/fits.c
@@ -447,8 +447,8 @@
pixel=GetFITSPixel(image,fits_info.bits_per_pixel);
q->red=(Quantum) ClampToQuantum(scale*(fits_info.scale*(pixel-
fits_info.min_data)+fits_info.zero));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
diff --git a/coders/jp2.c b/coders/jp2.c
index 9c63098..c1091a6 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -537,8 +537,8 @@
{
pixel=(QuantumAny) jas_matrix_getv(pixels[0],x/x_step[0]);
q->red=(Quantum) ScaleAnyToQuantum((QuantumAny) pixel,range[0]);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
break;
diff --git a/coders/mtv.c b/coders/mtv.c
index 77dceb0..306173c 100644
--- a/coders/mtv.c
+++ b/coders/mtv.c
@@ -176,9 +176,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
SetOpacityPixelComponent(q,OpaqueOpacity);
q++;
}
diff --git a/coders/pict.c b/coders/pict.c
index d6c8a3d..6168b47 100644
--- a/coders/pict.c
+++ b/coders/pict.c
@@ -1204,7 +1204,7 @@
if (p > (pixels+extent+2*image->columns))
ThrowReaderException(CorruptImageError,
"NotEnoughPixelData");
- q->red=ScaleCharToQuantum(*p);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
q->green=ScaleCharToQuantum(
*(p+tile_image->columns));
q->blue=ScaleCharToQuantum(
diff --git a/coders/pnm.c b/coders/pnm.c
index 6a0290f..f84458c 100644
--- a/coders/pnm.c
+++ b/coders/pnm.c
@@ -441,8 +441,8 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
q->red=(Quantum) (PNMInteger(image,2) == 0 ? QuantumRange : 0);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -496,8 +496,8 @@
q->red=(Quantum) intensity;
if (scale != (Quantum *) NULL)
q->red=scale[ConstrainPixel(image,(ssize_t) intensity,max_value)];
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -730,8 +730,8 @@
{
p=PushCharPixel(p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
}
@@ -744,8 +744,8 @@
{
p=PushShortPixel(MSBEndian,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
}
@@ -830,9 +830,9 @@
if (image->depth == 8)
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q->opacity=OpaqueOpacity;
q++;
}
@@ -1026,8 +1026,8 @@
{
p=PushCharPixel(p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
@@ -1047,8 +1047,8 @@
{
p=PushShortPixel(MSBEndian,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
diff --git a/coders/psd.c b/coders/psd.c
index 8df88d5..5c1aca8 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -643,8 +643,8 @@
q->red=pixel;
if (channels == 1)
{
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
}
if (image->storage_class == PseudoClass)
{
diff --git a/coders/rle.c b/coders/rle.c
index 42a689e..e5662d0 100644
--- a/coders/rle.c
+++ b/coders/rle.c
@@ -443,9 +443,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
if (image->matte != MagickFalse)
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p++));
q++;
diff --git a/coders/sgi.c b/coders/sgi.c
index b93c0c9..6cf92ea 100644
--- a/coders/sgi.c
+++ b/coders/sgi.c
@@ -584,7 +584,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
q->green=ScaleCharToQuantum(*(p+1));
q->blue=ScaleCharToQuantum(*(p+2));
SetOpacityPixelComponent(q,OpaqueOpacity);
diff --git a/coders/sun.c b/coders/sun.c
index 347cfbb..9bceb0f 100644
--- a/coders/sun.c
+++ b/coders/sun.c
@@ -524,15 +524,15 @@
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p++));
if (sun_info.type == RT_STANDARD)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
}
else
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
}
if (image->colors != 0)
{
diff --git a/coders/tim.c b/coders/tim.c
index a412cb6..a3735b3 100644
--- a/coders/tim.c
+++ b/coders/tim.c
@@ -358,9 +358,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
diff --git a/coders/viff.c b/coders/viff.c
index 9d3641c..9305256 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -690,7 +690,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
q->green=ScaleCharToQuantum(*(p+number_pixels));
q->blue=ScaleCharToQuantum(*(p+2*number_pixels));
if (image->colors != 0)
diff --git a/coders/webp.c b/coders/webp.c
index 7751534..9a4cc34 100644
--- a/coders/webp.c
+++ b/coders/webp.c
@@ -170,9 +170,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p++));
if (q->opacity != OpaqueOpacity)
image->matte=MagickTrue;
diff --git a/coders/wpg.c b/coders/wpg.c
index 8419b17..e38521f 100644
--- a/coders/wpg.c
+++ b/coders/wpg.c
@@ -414,9 +414,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (!SyncAuthenticPixels(image,exception))
diff --git a/coders/xcf.c b/coders/xcf.c
index 155ff80..6a20dd3 100644
--- a/coders/xcf.c
+++ b/coders/xcf.c
@@ -374,8 +374,8 @@
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
q->red=ScaleCharToQuantum(*graydata);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q->opacity=ScaleCharToQuantum((unsigned char) (255-
inLayerInfo->opacity));
graydata++;
@@ -546,8 +546,8 @@
}
else
{
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q->opacity=ScaleCharToQuantum((unsigned char) (255-
inLayerInfo->opacity));
}
diff --git a/coders/yuv.c b/coders/yuv.c
index 936e69a..b7aaa9a 100644
--- a/coders/yuv.c
+++ b/coders/yuv.c
@@ -251,7 +251,7 @@
p+=2;
}
if (quantum == 1)
- q->red=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->red=ScaleShortToQuantum(((*p) << 8) | *(p+1));
@@ -270,7 +270,7 @@
p+=2;
}
if (quantum == 1)
- q->red=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->red=ScaleShortToQuantum(((*p) << 8) | *(p+1));
@@ -291,7 +291,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
if (quantum == 1)
- q->red=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->red=ScaleShortToQuantum(((*p) << 8) | *(p+1));
@@ -340,7 +340,7 @@
{
q->red=(Quantum) 0;
if (quantum == 1)
- q->green=ScaleCharToQuantum(*p++);
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->green=ScaleShortToQuantum(((*p) << 8) | *(p+1));
@@ -374,7 +374,7 @@
for (x=0; x < (ssize_t) chroma_image->columns; x++)
{
if (quantum == 1)
- q->blue=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->blue=ScaleShortToQuantum(((*p) << 8) | *(p+1));
diff --git a/magick/pixel.c b/magick/pixel.c
index fb3f6ac..3a0cedd 100644
--- a/magick/pixel.c
+++ b/magick/pixel.c
@@ -1843,9 +1843,9 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -1862,9 +1862,9 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
q->opacity=(Quantum) QuantumRange-ScaleCharToQuantum(*p++);
q++;
}
@@ -1882,10 +1882,10 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
- q->opacity=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetOpacityPixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -1902,9 +1902,9 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
p++;
q++;
}
@@ -1922,9 +1922,9 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=q->red;
- q->blue=q->red;
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -1941,9 +1941,9 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -1960,9 +1960,9 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q->opacity=(Quantum) QuantumRange-ScaleCharToQuantum(*p++);
q++;
}
@@ -1980,10 +1980,10 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
- q->opacity=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetOpacityPixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -2000,9 +2000,9 @@
break;
for (x=0; x < (ssize_t) columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
p++;
q++;
}
@@ -2026,19 +2026,19 @@
case RedQuantum:
case CyanQuantum:
{
- q->red=ScaleCharToQuantum(*p);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
break;
}
case GreenQuantum:
case MagentaQuantum:
{
- q->green=ScaleCharToQuantum(*p);
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p));
break;
}
case BlueQuantum:
case YellowQuantum:
{
- q->blue=ScaleCharToQuantum(*p);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p));
break;
}
case AlphaQuantum:
@@ -2048,19 +2048,19 @@
}
case OpacityQuantum:
{
- q->opacity=ScaleCharToQuantum(*p);
+ SetOpacityPixelComponent(q,ScaleCharToQuantum(*p));
break;
}
case BlackQuantum:
{
- indexes[x]=ScaleCharToQuantum(*p);
+ SetIndexPixelComponent(indexes+x,ScaleCharToQuantum(*p));
break;
}
case IndexQuantum:
{
- q->red=ScaleCharToQuantum(*p);
- q->green=q->red;
- q->blue=q->red;
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
break;
}
default:
@@ -2161,8 +2161,8 @@
for (x=0; x < (ssize_t) columns; x++)
{
q->red=ClampToQuantum((MagickRealType) QuantumRange*(*p));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p++;
q++;
}
@@ -2289,8 +2289,8 @@
case IndexQuantum:
{
q->red=ClampToQuantum((MagickRealType) QuantumRange*(*p));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
break;
}
default:
@@ -2391,8 +2391,8 @@
for (x=0; x < (ssize_t) columns; x++)
{
q->red=ClampToQuantum((MagickRealType) QuantumRange*(*p));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p++;
q++;
}
@@ -2519,8 +2519,8 @@
case IndexQuantum:
{
q->red=ClampToQuantum((MagickRealType) QuantumRange*(*p));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
break;
}
default:
@@ -2610,8 +2610,8 @@
for (x=0; x < (ssize_t) columns; x++)
{
q->red=ScaleLongToQuantum(*p++);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -2726,8 +2726,8 @@
case IndexQuantum:
{
q->red=ScaleLongToQuantum(*p);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
break;
}
default:
@@ -2817,8 +2817,8 @@
for (x=0; x < (ssize_t) columns; x++)
{
q->red=ScaleLongToQuantum(*p++);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -2933,8 +2933,8 @@
case IndexQuantum:
{
q->red=ScaleLongToQuantum(*p);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
break;
}
default:
@@ -3024,8 +3024,8 @@
for (x=0; x < (ssize_t) columns; x++)
{
q->red=(*p++);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -3140,8 +3140,8 @@
case IndexQuantum:
{
q->red=(*p);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
break;
}
default:
@@ -3231,8 +3231,8 @@
for (x=0; x < (ssize_t) columns; x++)
{
q->red=ScaleShortToQuantum(*p++);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -3347,8 +3347,8 @@
case IndexQuantum:
{
q->red=ScaleShortToQuantum(*p);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
break;
}
default:
diff --git a/magick/profile.c b/magick/profile.c
index b698b58..818b875 100644
--- a/magick/profile.c
+++ b/magick/profile.c
@@ -1268,8 +1268,8 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
q->red=ScaleShortToQuantum(*p);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p++;
if (target_channels > 1)
{
diff --git a/magick/quantum-import.c b/magick/quantum-import.c
index 87aa14a..9e1ad54 100644
--- a/magick/quantum-import.c
+++ b/magick/quantum-import.c
@@ -533,8 +533,8 @@
0x00 : 0x01);
indexes[x+bit/2]=(IndexPacket) (pixel == 0 ? 0 : 1);
q->red=(Quantum) (pixel == 0 ? 0 : QuantumRange);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q->opacity=(Quantum) (((*p) & (1UL << (unsigned char) (6-bit)))
== 0 ? TransparentOpacity : OpaqueOpacity);
q++;
@@ -550,8 +550,8 @@
0x00 : 0x01);
indexes[x+bit/2]=(IndexPacket) (pixel == 0 ? 0 : 1);
q->red=(Quantum) (pixel == 0 ? 0 : QuantumRange);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q->opacity=(Quantum) (((*p) & (1UL << (unsigned char) (6-bit))) ==
0 ? TransparentOpacity : OpaqueOpacity);
q++;
@@ -1231,8 +1231,8 @@
for (bit=0; bit < 8; bit++)
{
q->red=(((*p) & (1 << (7-bit))) == 0 ? black : white);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
p++;
@@ -1240,8 +1240,8 @@
for (bit=0; bit < (ssize_t) (number_pixels % 8); bit++)
{
q->red=(((*p) & (0x01 << (7-bit))) == 0 ? black : white);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (bit != 0)
@@ -1258,13 +1258,13 @@
{
pixel=(unsigned char) ((*p >> 4) & 0xf);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
pixel=(unsigned char) ((*p) & 0xf);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p++;
q++;
}
@@ -1272,8 +1272,8 @@
{
pixel=(unsigned char) (*p++ >> 4);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
break;
@@ -1289,8 +1289,8 @@
{
p=PushCharPixel(p,&pixel);
q->red=(Quantum) (QuantumRange-ScaleCharToQuantum(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
SetOpacityPixelComponent(q,OpaqueOpacity);
p+=quantum_info->pad;
q++;
@@ -1301,8 +1301,8 @@
{
p=PushCharPixel(p,&pixel);
SetRedPixelComponent(q,ScaleCharToQuantum(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
SetOpacityPixelComponent(q,OpaqueOpacity);
p+=quantum_info->pad;
q++;
@@ -1320,16 +1320,16 @@
{
p=PushLongPixel(endian,p,&pixel);
q->red=ScaleAnyToQuantum((pixel >> 2) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
q->red=ScaleAnyToQuantum((pixel >> 12) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
q->red=ScaleAnyToQuantum((pixel >> 22) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1337,15 +1337,15 @@
if (x++ < (ssize_t) (number_pixels-1))
{
q->red=ScaleAnyToQuantum((pixel >> 2) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (x++ < (ssize_t) number_pixels)
{
q->red=ScaleAnyToQuantum((pixel >> 12) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
break;
@@ -1354,16 +1354,16 @@
{
p=PushLongPixel(endian,p,&pixel);
q->red=ScaleAnyToQuantum((pixel >> 22) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
q->red=ScaleAnyToQuantum((pixel >> 12) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
q->red=ScaleAnyToQuantum((pixel >> 2) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1371,15 +1371,15 @@
if (x++ < (ssize_t) (number_pixels-1))
{
q->red=ScaleAnyToQuantum((pixel >> 22) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (x++ < (ssize_t) number_pixels)
{
q->red=ScaleAnyToQuantum((pixel >> 12) & 0x3ff,range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
break;
@@ -1388,8 +1388,8 @@
{
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1407,13 +1407,13 @@
{
p=PushShortPixel(endian,p,&pixel);
q->red=ScaleAnyToQuantum((QuantumAny) (pixel >> 4),range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
p=PushShortPixel(endian,p,&pixel);
q->red=ScaleAnyToQuantum((QuantumAny) (pixel >> 4),range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1421,8 +1421,8 @@
{
p=PushShortPixel(endian,p,&pixel);
q->red=ScaleAnyToQuantum((QuantumAny) (pixel >> 4),range);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1434,8 +1434,8 @@
{
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1452,8 +1452,8 @@
{
p=PushShortPixel(endian,p,&pixel);
q->red=(Quantum) (QuantumRange-ScaleShortToQuantum(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1466,8 +1466,8 @@
p=PushShortPixel(endian,p,&pixel);
q->red=ClampToQuantum((MagickRealType) QuantumRange*
HalfToSinglePrecision(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1477,8 +1477,8 @@
{
p=PushShortPixel(endian,p,&pixel);
SetRedPixelComponent(q,ScaleShortToQuantum(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1498,8 +1498,8 @@
{
p=PushFloatPixel(&quantum_state,p,&pixel);
q->red=ClampToQuantum(pixel);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1509,8 +1509,8 @@
{
p=PushLongPixel(endian,p,&pixel);
SetRedPixelComponent(q,ScaleLongToQuantum(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1527,8 +1527,8 @@
{
p=PushDoublePixel(&quantum_state,p,&pixel);
q->red=ClampToQuantum(pixel);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1542,8 +1542,8 @@
{
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p+=quantum_info->pad;
q++;
}
@@ -1568,8 +1568,8 @@
pixel=(unsigned char)
(((*p) & (1 << (7-bit))) != 0 ? 0x00 : 0x01);
q->red=(Quantum) (pixel == 0 ? 0 : QuantumRange);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q->opacity=(Quantum) (((*p) & (1UL << (unsigned char) (6-bit)))
== 0 ? TransparentOpacity : OpaqueOpacity);
q++;
@@ -1580,8 +1580,8 @@
{
pixel=(unsigned char) (((*p) & (1 << (7-bit))) != 0 ? 0x00 : 0x01);
q->red=(Quantum) (pixel != 0 ? 0 : QuantumRange);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q->opacity=(Quantum) (((*p) & (1UL << (unsigned char) (6-bit)))
== 0 ? TransparentOpacity : OpaqueOpacity);
q++;
@@ -1600,8 +1600,8 @@
{
pixel=(unsigned char) ((*p >> 4) & 0xf);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
pixel=(unsigned char) ((*p) & 0xf);
q->opacity=(Quantum) (QuantumRange-ScaleAnyToQuantum(pixel,range));
p++;
@@ -1618,8 +1618,8 @@
{
p=PushCharPixel(p,&pixel);
SetRedPixelComponent(q,ScaleCharToQuantum(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushCharPixel(p,&pixel);
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(pixel));
p+=quantum_info->pad;
@@ -1634,8 +1634,8 @@
{
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
SetOpacityPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p+=quantum_info->pad;
@@ -1650,8 +1650,8 @@
{
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
SetOpacityPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p+=quantum_info->pad;
@@ -1671,8 +1671,8 @@
p=PushShortPixel(endian,p,&pixel);
q->red=ClampToQuantum((MagickRealType) QuantumRange*
HalfToSinglePrecision(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushShortPixel(endian,p,&pixel);
q->opacity=(Quantum) (QuantumRange-ClampToQuantum(
(MagickRealType) QuantumRange*HalfToSinglePrecision(pixel)));
@@ -1685,8 +1685,8 @@
{
p=PushShortPixel(endian,p,&pixel);
SetRedPixelComponent(q,ScaleShortToQuantum(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushShortPixel(endian,p,&pixel);
q->opacity=(Quantum) (QuantumRange-ScaleShortToQuantum(pixel));
p+=quantum_info->pad;
@@ -1708,8 +1708,8 @@
{
p=PushFloatPixel(&quantum_state,p,&pixel);
q->red=ClampToQuantum(pixel);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushFloatPixel(&quantum_state,p,&pixel);
q->opacity=(Quantum) (QuantumRange-ClampToQuantum(pixel));
p+=quantum_info->pad;
@@ -1721,8 +1721,8 @@
{
p=PushLongPixel(endian,p,&pixel);
SetRedPixelComponent(q,ScaleLongToQuantum(pixel));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushLongPixel(endian,p,&pixel);
q->opacity=(Quantum) (QuantumRange-ScaleLongToQuantum(pixel));
p+=quantum_info->pad;
@@ -1741,8 +1741,8 @@
{
p=PushDoublePixel(&quantum_state,p,&pixel);
q->red=ClampToQuantum(pixel);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushDoublePixel(&quantum_state,p,&pixel);
q->opacity=(Quantum) (QuantumRange-ClampToQuantum(pixel));
p+=quantum_info->pad;
@@ -1758,8 +1758,8 @@
{
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
q->opacity=(Quantum) (QuantumRange-ScaleAnyToQuantum(pixel,range));
p+=quantum_info->pad;
diff --git a/magick/threshold.c b/magick/threshold.c
index 3055786..35e2a5b 100644
--- a/magick/threshold.c
+++ b/magick/threshold.c
@@ -419,8 +419,8 @@
{
q->red=(Quantum) ((MagickRealType) PixelIntensityToQuantum(q) <=
threshold ? 0 : QuantumRange);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
}