From: Cristy Date: Sun, 24 Dec 2017 14:34:52 +0000 (-0500) Subject: Introducing the sGray (non-linear grayscale) colorspace X-Git-Tag: 7.0.7-16~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95ab38988cbf47325b85c9f7a6385bfde08dd0a3;p=imagemagick Introducing the sGray (non-linear grayscale) colorspace --- diff --git a/MagickCore/accelerate-kernels-private.h b/MagickCore/accelerate-kernels-private.h index 717d52bc7..9d785f4bb 100644 --- a/MagickCore/accelerate-kernels-private.h +++ b/MagickCore/accelerate-kernels-private.h @@ -59,7 +59,7 @@ const char *accelerateKernels = { UndefinedColorspace, RGBColorspace, /* Linear RGB colorspace */ - GRAYColorspace, /* greyscale (linear) image (faked 1 channel) */ + sGRAYColorspace, /* greyscale (linear) image (faked 1 channel) */ TransparentColorspace, OHTAColorspace, LabColorspace, @@ -483,7 +483,7 @@ OPENCL_ENDIF() { float intensity; - if (colorspace == GRAYColorspace) + if (colorspace == sGRAYColorspace) return red; switch (method) diff --git a/MagickCore/accelerate.c b/MagickCore/accelerate.c index c2c20728a..86c9e1673 100644 --- a/MagickCore/accelerate.c +++ b/MagickCore/accelerate.c @@ -114,7 +114,8 @@ static MagickBooleanType checkAccelerateCondition(const Image* image) /* check if the image's colorspace is supported */ if (image->colorspace != RGBColorspace && image->colorspace != sRGBColorspace && - image->colorspace != GRAYColorspace) + image->colorspace != GRAYColorspace && + image->colorspace != sGRAYColorspace) return(MagickFalse); /* check if the virtual pixel method is compatible with the OpenCL implementation */ @@ -1019,7 +1020,7 @@ static MagickBooleanType ComputeContrastStretchImage(Image *image, /* if (IsGrayImage(image,exception) != MagickFalse) - (void) SetImageColorspace(image,GRAYColorspace); + (void) SetImageColorspace(image,sGRAYColorspace); */ status=MagickTrue; diff --git a/MagickCore/attribute.c b/MagickCore/attribute.c index 94daad829..edf451dfc 100644 --- a/MagickCore/attribute.c +++ b/MagickCore/attribute.c @@ -1258,11 +1258,11 @@ MagickExport MagickBooleanType SetImageType(Image *image,const ImageType type, { if (SetImageMonochrome(image,exception) == MagickFalse) { - status=TransformImageColorspace(image,GRAYColorspace,exception); + status=TransformImageColorspace(image,sGRAYColorspace,exception); (void) NormalizeImage(image,exception); quantize_info=AcquireQuantizeInfo(image_info); quantize_info->number_colors=2; - quantize_info->colorspace=GRAYColorspace; + quantize_info->colorspace=sGRAYColorspace; status=QuantizeImage(quantize_info,image,exception); quantize_info=DestroyQuantizeInfo(quantize_info); } @@ -1272,14 +1272,14 @@ MagickExport MagickBooleanType SetImageType(Image *image,const ImageType type, case GrayscaleType: { if (SetImageGray(image,exception) == MagickFalse) - status=TransformImageColorspace(image,GRAYColorspace,exception); + status=TransformImageColorspace(image,sGRAYColorspace,exception); image->alpha_trait=UndefinedPixelTrait; break; } case GrayscaleAlphaType: { if (SetImageGray(image,exception) == MagickFalse) - status=TransformImageColorspace(image,GRAYColorspace,exception); + status=TransformImageColorspace(image,sGRAYColorspace,exception); if (image->alpha_trait == UndefinedPixelTrait) (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception); break; diff --git a/MagickCore/channel.c b/MagickCore/channel.c index dd48e6007..03d3f04b4 100644 --- a/MagickCore/channel.c +++ b/MagickCore/channel.c @@ -284,7 +284,7 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression, if ((channel_op == ExtractChannelOp) && (channels == 1)) { (void) SetPixelMetaChannels(destination_image,0,exception); - (void) SetImageColorspace(destination_image,GRAYColorspace, + (void) SetImageColorspace(destination_image,sGRAYColorspace, exception); } canvas=CloneImage(source_image,0,0,MagickTrue,exception); @@ -444,7 +444,7 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression, if ((channel_op == ExtractChannelOp) && (channels == 1)) { (void) SetPixelMetaChannels(destination_image,0,exception); - (void) SetImageColorspace(destination_image,GRAYColorspace,exception); + (void) SetImageColorspace(destination_image,sGRAYColorspace,exception); } return(GetFirstImageInList(destination_image)); } @@ -533,6 +533,7 @@ MagickExport Image *CombineImages(const Image *image, break; } case GRAYColorspace: + case sGRAYColorspace: { if (GetImageListLength(image) > 1) combine_image->alpha_trait=BlendPixelTrait; @@ -732,7 +733,7 @@ MagickExport Image *SeparateImage(const Image *image, return((Image *) NULL); } separate_image->alpha_trait=UndefinedPixelTrait; - (void) SetImageColorspace(separate_image,GRAYColorspace,exception); + (void) SetImageColorspace(separate_image,sGRAYColorspace,exception); separate_image->gamma=image->gamma; /* Separate image. diff --git a/MagickCore/color.c b/MagickCore/color.c index c9f7578ba..ee1e4eb87 100644 --- a/MagickCore/color.c +++ b/MagickCore/color.c @@ -1589,7 +1589,8 @@ MagickExport void GetColorTuple(const PixelInfo *pixel, if (color.alpha_trait != UndefinedPixelTrait) (void) ConcatenateMagickString(tuple,"a",MagickPathExtent); (void) ConcatenateMagickString(tuple,"(",MagickPathExtent); - if (color.colorspace == GRAYColorspace) + if ((color.colorspace == GRAYColorspace) || + (color.colorspace == sGRAYColorspace)) ConcatenateColorComponent(&color,GrayPixelChannel,SVGCompliance,tuple); else { @@ -2455,7 +2456,7 @@ MagickExport MagickBooleanType QueryColorCompliance(const char *name, } if (LocaleCompare(colorspace,"gray") == 0) { - color->colorspace=GRAYColorspace; + color->colorspace=sGRAYColorspace; color->green=color->red; color->blue=color->red; if (((flags & SigmaValue) != 0) && diff --git a/MagickCore/colorspace-private.h b/MagickCore/colorspace-private.h index 94a6c5d8b..7e15e0ad1 100644 --- a/MagickCore/colorspace-private.h +++ b/MagickCore/colorspace-private.h @@ -96,7 +96,7 @@ static inline MagickBooleanType IsCMYKColorspace( static inline MagickBooleanType IsGrayColorspace( const ColorspaceType colorspace) { - if (colorspace == GRAYColorspace) + if ((colorspace == GRAYColorspace) || (colorspace == sGRAYColorspace)) return(MagickTrue); return(MagickFalse); } diff --git a/MagickCore/colorspace.c b/MagickCore/colorspace.c index 961240a5e..45c443112 100644 --- a/MagickCore/colorspace.c +++ b/MagickCore/colorspace.c @@ -98,7 +98,7 @@ static MagickBooleanType %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % GetImageColorspaceType() returns the potential type of image: -% sRGBColorspaceType, RGBColorspaceType, GRAYColorspaceType, etc. +% sRGBColorspaceType, RGBColorspaceType, sGRAYColorspaceType, etc. % % To ensure the image type matches its potential, use SetImageColorspaceType(): % @@ -134,7 +134,7 @@ MagickExport ColorspaceType GetImageColorspaceType(const Image *image, type=IdentifyImageType(image,exception); if ((type == BilevelType) || (type == GrayscaleType) || (type == GrayscaleAlphaType)) - colorspace=GRAYColorspace; + colorspace=sGRAYColorspace; return(colorspace); } @@ -380,6 +380,7 @@ static MagickBooleanType sRGBTransformImage(Image *image, return(status); } case GRAYColorspace: + case sGRAYColorspace: { /* Transform image from sRGB to GRAY. @@ -1234,7 +1235,7 @@ MagickExport MagickBooleanType SetImageGray(Image *image, type=IdentifyImageGray(image,exception); if (type == UndefinedType) return(MagickFalse); - image->colorspace=GRAYColorspace; + image->colorspace=sGRAYColorspace; if (SyncImagePixelCache((Image *) image,exception) == MagickFalse) return(MagickFalse); image->type=type; @@ -1287,7 +1288,7 @@ MagickExport MagickBooleanType SetImageMonochrome(Image *image, return(MagickFalse); if (IdentifyImageMonochrome(image,exception) == MagickFalse) return(MagickFalse); - image->colorspace=GRAYColorspace; + image->colorspace=sGRAYColorspace; if (SyncImagePixelCache((Image *) image,exception) == MagickFalse) return(MagickFalse); image->type=BilevelType; @@ -1334,7 +1335,8 @@ MagickExport MagickBooleanType TransformImageColorspace(Image *image, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (image->colorspace == colorspace) return(SetImageColorspace(image,colorspace,exception)); - if ((image->colorspace == RGBColorspace) && (colorspace == GRAYColorspace)) + if ((image->colorspace == RGBColorspace) && + ((colorspace == GRAYColorspace) || (colorspace == sGRAYColorspace))) return(GrayscaleImage(image,Rec709LuminancePixelIntensityMethod,exception)); if (colorspace == UndefinedColorspace) return(SetImageColorspace(image,colorspace,exception)); @@ -1846,6 +1848,7 @@ static MagickBooleanType TransformsRGBImage(Image *image, return(status); } case GRAYColorspace: + case sGRAYColorspace: { /* Transform linear GRAY to sRGB colorspace. diff --git a/MagickCore/colorspace.h b/MagickCore/colorspace.h index 849768bd5..3bf3de0e3 100644 --- a/MagickCore/colorspace.h +++ b/MagickCore/colorspace.h @@ -56,7 +56,8 @@ typedef enum YDbDrColorspace, YIQColorspace, YPbPrColorspace, - YUVColorspace + YUVColorspace, + sGRAYColorspace } ColorspaceType; extern MagickExport ColorspaceType diff --git a/MagickCore/delegate.c b/MagickCore/delegate.c index f1bd613e2..f4ef6011b 100644 --- a/MagickCore/delegate.c +++ b/MagickCore/delegate.c @@ -640,7 +640,7 @@ static char *GetMagickPropertyLetter(ImageInfo *image_info,Image *image, WarnNoImageReturn("\"%%%c\"",letter); colorspace=image->colorspace; if (SetImageGray(image,exception) != MagickFalse) - colorspace=GRAYColorspace; /* FUTURE: this is IMv6 not IMv7 */ + colorspace=sGRAYColorspace; /* FUTURE: this is IMv6 not IMv7 */ (void) FormatLocaleString(value,MagickPathExtent,"%s %s %s", CommandOptionToMnemonic(MagickClassOptions,(ssize_t) image->storage_class),CommandOptionToMnemonic(MagickColorspaceOptions, diff --git a/MagickCore/effect.c b/MagickCore/effect.c index 0b004020e..ba870dc03 100644 --- a/MagickCore/effect.c +++ b/MagickCore/effect.c @@ -2433,7 +2433,7 @@ MagickExport Image *PreviewImage(const Image *image,const PreviewType preview, break; colors<<=1; quantize_info.number_colors=colors; - quantize_info.colorspace=GRAYColorspace; + quantize_info.colorspace=sGRAYColorspace; (void) QuantizeImage(&quantize_info,preview_image,exception); (void) FormatLocaleString(label,MagickPathExtent, "-colorspace gray -colors %.20g",(double) colors); @@ -3169,7 +3169,7 @@ MagickExport Image *SelectiveBlurImage(const Image *image,const double radius, kernel=(MagickRealType *) RelinquishAlignedMemory(kernel); return((Image *) NULL); } - status=TransformImageColorspace(luminance_image,GRAYColorspace,exception); + status=TransformImageColorspace(luminance_image,sGRAYColorspace,exception); if (status == MagickFalse) { luminance_image=DestroyImage(luminance_image); diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index f1663cd56..b7532b006 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -1049,7 +1049,7 @@ MagickExport MagickBooleanType ContrastStretchImage(Image *image, if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (SetImageGray(image,exception) != MagickFalse) - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); black=(double *) AcquireQuantumMemory(MaxPixelChannels,sizeof(*black)); white=(double *) AcquireQuantumMemory(MaxPixelChannels,sizeof(*white)); histogram=(double *) AcquireQuantumMemory(MaxMap+1UL,MaxPixelChannels* @@ -1990,7 +1990,7 @@ MagickExport MagickBooleanType GrayscaleImage(Image *image, { image->intensity=method; image->type=GrayscaleType; - return(SetImageColorspace(image,GRAYColorspace,exception)); + return(SetImageColorspace(image,sGRAYColorspace,exception)); } #endif /* @@ -2134,7 +2134,7 @@ MagickExport MagickBooleanType GrayscaleImage(Image *image, image_view=DestroyCacheView(image_view); image->intensity=method; image->type=GrayscaleType; - return(SetImageColorspace(image,GRAYColorspace,exception)); + return(SetImageColorspace(image,sGRAYColorspace,exception)); } /* diff --git a/MagickCore/feature.c b/MagickCore/feature.c index 6dda2b89c..3bac61af2 100644 --- a/MagickCore/feature.c +++ b/MagickCore/feature.c @@ -291,7 +291,7 @@ MagickExport Image *CannyEdgeImage(const Image *image,const double radius, kernel_info=DestroyKernelInfo(kernel_info); if (edge_image == (Image *) NULL) return((Image *) NULL); - if (TransformImageColorspace(edge_image,GRAYColorspace,exception) == MagickFalse) + if (TransformImageColorspace(edge_image,sGRAYColorspace,exception) == MagickFalse) { edge_image=DestroyImage(edge_image); return((Image *) NULL); diff --git a/MagickCore/identify.c b/MagickCore/identify.c index a372549c5..7eaa54a10 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -573,8 +573,8 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, { (void) PrintChannelLocations(file,image,CyanPixelChannel,"Cyan", statistic_type,max_locations,channel_statistics); - (void) PrintChannelLocations(file,image,MagentaPixelChannel,"Magenta", - statistic_type,max_locations,channel_statistics); + (void) PrintChannelLocations(file,image,MagentaPixelChannel, + "Magenta",statistic_type,max_locations,channel_statistics); (void) PrintChannelLocations(file,image,YellowPixelChannel,"Yellow", statistic_type,max_locations,channel_statistics); (void) PrintChannelLocations(file,image,BlackPixelChannel,"Black", @@ -582,6 +582,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) PrintChannelLocations(file,image,GrayPixelChannel,"Gray", statistic_type,max_locations,channel_statistics); @@ -795,6 +796,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) FormatLocaleFile(file," Gray: %.20g-bit\n",(double) channel_statistics[GrayPixelChannel].depth); @@ -847,6 +849,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) PrintChannelStatistics(file,GrayPixelChannel,"Gray",1.0/ scale,channel_statistics); @@ -870,7 +873,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, if (image->alpha_trait != UndefinedPixelTrait) (void) PrintChannelStatistics(file,AlphaPixelChannel,"Alpha",1.0/ scale,channel_statistics); - if (colorspace != GRAYColorspace) + if ((colorspace != GRAYColorspace) && (colorspace != sGRAYColorspace)) { (void) FormatLocaleFile(file," Image statistics:\n"); (void) PrintChannelStatistics(file,CompositePixelChannel,"Overall", @@ -908,7 +911,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, channel_moments); break; } - case GRAYColorspace: + case sGRAYColorspace: { (void) PrintChannelMoments(file,GrayPixelChannel,"Gray",scale, channel_moments); @@ -932,7 +935,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, if (image->alpha_trait != UndefinedPixelTrait) (void) PrintChannelMoments(file,AlphaPixelChannel,"Alpha",scale, channel_moments); - if (colorspace != GRAYColorspace) + if (colorspace != sGRAYColorspace) { (void) FormatLocaleFile(file," Image moments:\n"); (void) PrintChannelMoments(file,CompositePixelChannel,"Overall",scale, @@ -976,7 +979,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, channel_features); break; } - case GRAYColorspace: + case sGRAYColorspace: { (void) PrintChannelFeatures(file,GrayPixelChannel,"Gray", channel_features); diff --git a/MagickCore/image.c b/MagickCore/image.c index f61292786..f33ec40e8 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -1463,7 +1463,7 @@ MagickExport Image *GetImageMask(const Image *image,const PixelMask type, return((Image *) NULL); status=MagickTrue; mask_image->alpha_trait=UndefinedPixelTrait; - (void) SetImageColorspace(mask_image,GRAYColorspace,exception); + (void) SetImageColorspace(mask_image,sGRAYColorspace,exception); mask_image->read_mask=MagickFalse; image_view=AcquireVirtualCacheView(image,exception); mask_view=AcquireAuthenticCacheView(mask_image,exception); diff --git a/MagickCore/matrix.c b/MagickCore/matrix.c index 74b9f33b0..116f81cb2 100644 --- a/MagickCore/matrix.c +++ b/MagickCore/matrix.c @@ -934,7 +934,7 @@ MagickExport Image *MatrixToImage(const MatrixInfo *matrix_info, image=AcquireImage((ImageInfo *) NULL,exception); image->columns=matrix_info->columns; image->rows=matrix_info->rows; - image->colorspace=GRAYColorspace; + image->colorspace=sGRAYColorspace; status=MagickTrue; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) diff --git a/MagickCore/option.c b/MagickCore/option.c index d81e2d7c2..7b019c32b 100644 --- a/MagickCore/option.c +++ b/MagickCore/option.c @@ -480,6 +480,7 @@ static const OptionInfo { "Rec709YCbCr", Rec709YCbCrColorspace, UndefinedOptionFlag, MagickFalse }, { "RGB", RGBColorspace, UndefinedOptionFlag, MagickFalse }, { "scRGB", scRGBColorspace, UndefinedOptionFlag, MagickFalse }, + { "sGray", sGRAYColorspace, UndefinedOptionFlag, MagickFalse }, { "sRGB", sRGBColorspace, UndefinedOptionFlag, MagickFalse }, { "Transparent", TransparentColorspace, UndefinedOptionFlag, MagickFalse }, { "xyY", xyYColorspace, UndefinedOptionFlag, MagickFalse }, diff --git a/MagickCore/paint.c b/MagickCore/paint.c index 05928fd0c..3557f9b99 100644 --- a/MagickCore/paint.c +++ b/MagickCore/paint.c @@ -191,7 +191,7 @@ MagickExport MagickBooleanType FloodfillPaintImage(Image *image, if (floodplane_image == (Image *) NULL) return(MagickFalse); floodplane_image->alpha_trait=UndefinedPixelTrait; - floodplane_image->colorspace=GRAYColorspace; + floodplane_image->colorspace=sGRAYColorspace; (void) QueryColorCompliance("#000",AllCompliance, &floodplane_image->background_color,exception); (void) SetImageBackgroundColor(floodplane_image,exception); diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index 919e4510d..d76a8dba1 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -4207,7 +4207,7 @@ MagickExport MagickBooleanType ImportImagePixels(Image *image,const ssize_t x, case 'i': { quantum_map[i]=IndexQuantum; - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); break; } case 'm': @@ -4350,7 +4350,8 @@ MagickExport void InitializePixelChannelMap(Image *image) if (image->alpha_trait != UndefinedPixelTrait) trait=(PixelTrait) (trait | BlendPixelTrait); n=0; - if (image->colorspace == GRAYColorspace) + if ((image->colorspace == GRAYColorspace) || + (image->colorspace == sGRAYColorspace)) { SetPixelChannelAttributes(image,BluePixelChannel,trait,n); SetPixelChannelAttributes(image,GreenPixelChannel,trait,n); @@ -6199,7 +6200,7 @@ static void LogPixelChannels(const Image *image) name="red"; if (image->colorspace == CMYKColorspace) name="cyan"; - if (image->colorspace == GRAYColorspace) + if (image->colorspace == sGRAYColorspace) name="gray"; break; } diff --git a/MagickCore/profile.c b/MagickCore/profile.c index 490a809f3..42f3b6bc4 100644 --- a/MagickCore/profile.c +++ b/MagickCore/profile.c @@ -927,7 +927,7 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name, } case cmsSigGrayData: { - source_colorspace=GRAYColorspace; + source_colorspace=sGRAYColorspace; source_type=(cmsUInt32Number) TYPE_GRAY_DBL; source_channels=1; break; @@ -983,7 +983,7 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name, } case cmsSigGrayData: { - target_colorspace=GRAYColorspace; + target_colorspace=sGRAYColorspace; target_type=(cmsUInt32Number) TYPE_GRAY_DBL; target_channels=1; break; @@ -1011,7 +1011,8 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name, (target_colorspace == UndefinedColorspace)) ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch", name); - if ((source_colorspace == GRAYColorspace) && + if (((source_colorspace == GRAYColorspace) || + (source_colorspace == sGRAYColorspace)) && (SetImageGray(image,exception) == MagickFalse)) ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch", name); diff --git a/MagickCore/property.c b/MagickCore/property.c index b1fcd649e..079e952d5 100644 --- a/MagickCore/property.c +++ b/MagickCore/property.c @@ -2512,7 +2512,7 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info, WarnNoImageReturn("\"%%%c\"",letter); colorspace=image->colorspace; if (SetImageGray(image,exception) != MagickFalse) - colorspace=GRAYColorspace; /* FUTURE: this is IMv6 not IMv7 */ + colorspace=sGRAYColorspace; /* FUTURE: this is IMv6 not IMv7 */ (void) FormatLocaleString(value,MagickPathExtent,"%s %s %s", CommandOptionToMnemonic(MagickClassOptions,(ssize_t) image->storage_class),CommandOptionToMnemonic(MagickColorspaceOptions, diff --git a/MagickCore/quantize.c b/MagickCore/quantize.c index 660b7f8b1..bb21f870b 100644 --- a/MagickCore/quantize.c +++ b/MagickCore/quantize.c @@ -643,7 +643,8 @@ static MagickBooleanType AssignImageColors(Image *image,CubeInfo *cube_info, if (cube_info->quantize_info->measure_error != MagickFalse) (void) GetImageQuantizeError(image,exception); if ((cube_info->quantize_info->number_colors == 2) && - (cube_info->quantize_info->colorspace == GRAYColorspace)) + ((cube_info->quantize_info->colorspace == GRAYColorspace) || + (cube_info->quantize_info->colorspace == sGRAYColorspace))) { double intensity; @@ -742,7 +743,8 @@ static inline void SetAssociatedAlpha(const Image *image,CubeInfo *cube_info) associate_alpha=image->alpha_trait == BlendPixelTrait ? MagickTrue : MagickFalse; if ((cube_info->quantize_info->number_colors == 2) && - (cube_info->quantize_info->colorspace == GRAYColorspace)) + ((cube_info->quantize_info->colorspace == GRAYColorspace) || + (cube_info->quantize_info->colorspace == sGRAYColorspace))) associate_alpha=MagickFalse; cube_info->associate_alpha=associate_alpha; } @@ -3315,7 +3317,7 @@ static MagickBooleanType SetGrayscaleImage(Image *image, assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->type != GrayscaleType) - (void) TransformImageColorspace(image,GRAYColorspace,exception); + (void) TransformImageColorspace(image,sGRAYColorspace,exception); colormap_index=(ssize_t *) AcquireQuantumMemory(MaxColormapSize, sizeof(*colormap_index)); if (colormap_index == (ssize_t *) NULL) diff --git a/MagickWand/animate.c b/MagickWand/animate.c index 6758f04db..dd6ab545d 100644 --- a/MagickWand/animate.c +++ b/MagickWand/animate.c @@ -1072,7 +1072,7 @@ WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info, if (*option == '+') break; quantize_info->number_colors=2; - quantize_info->colorspace=GRAYColorspace; + quantize_info->colorspace=sGRAYColorspace; break; } ThrowAnimateException(OptionError,"UnrecognizedOption",option); diff --git a/MagickWand/compare.c b/MagickWand/compare.c index 524af9630..6920f998f 100644 --- a/MagickWand/compare.c +++ b/MagickWand/compare.c @@ -1338,6 +1338,7 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) FormatLocaleFile(stderr," gray: %g (%g)\n", QuantumRange*channel_distortion[GrayPixelChannel], @@ -1393,6 +1394,7 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) FormatLocaleFile(stderr," gray: %g\n", channel_distortion[GrayPixelChannel]); diff --git a/MagickWand/display.c b/MagickWand/display.c index 784446397..69f7a602b 100644 --- a/MagickWand/display.c +++ b/MagickWand/display.c @@ -1405,7 +1405,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, if (*option == '+') break; quantize_info->number_colors=2; - quantize_info->colorspace=GRAYColorspace; + quantize_info->colorspace=sGRAYColorspace; break; } ThrowDisplayException(OptionError,"UnrecognizedOption",option); diff --git a/MagickWand/import.c b/MagickWand/import.c index be13c14a1..cdd782132 100644 --- a/MagickWand/import.c +++ b/MagickWand/import.c @@ -979,7 +979,7 @@ WandExport MagickBooleanType ImportImageCommand(ImageInfo *image_info, if (*option == '+') break; quantize_info->number_colors=2; - quantize_info->colorspace=GRAYColorspace; + quantize_info->colorspace=sGRAYColorspace; break; } ThrowImportException(OptionError,"UnrecognizedOption",option); diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 7f5d2318b..aa5990b83 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -9338,7 +9338,7 @@ WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand, % o wand: the magick wand. % % o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace, -% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace, +% sGRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace, % YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace, % YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace, % HSLColorspace, or HWBColorspace. @@ -11870,7 +11870,7 @@ WandExport MagickBooleanType MagickTintImage(MagickWand *wand, % o wand: the magick wand. % % o colorspace: the image colorspace: UndefinedColorspace, -% sRGBColorspace, RGBColorspace, GRAYColorspace, +% sRGBColorspace, RGBColorspace, sGRAYColorspace, % OHTAColorspace, XYZColorspace, YCbCrColorspace, % YCCColorspace, YIQColorspace, YPbPrColorspace, % YPbPrColorspace, YUVColorspace, CMYKColorspace, diff --git a/MagickWand/operation.c b/MagickWand/operation.c index 76748d703..f0273d1c8 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -2029,7 +2029,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, /* clean up and set the write mask */ mask_view=DestroyCacheView(mask_view); mask_image->alpha_trait=BlendPixelTrait; - (void) SetImageColorspace(_image,GRAYColorspace,_exception); + (void) SetImageColorspace(_image,sGRAYColorspace,_exception); (void) SetImageMask(_image,ReadPixelMask,mask_image,_exception); mask_image=DestroyImage(mask_image); break; diff --git a/coders/art.c b/coders/art.c index 3feb99396..fbd2c86de 100644 --- a/coders/art.c +++ b/coders/art.c @@ -152,7 +152,7 @@ static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Convert bi-level image to pixel packets. */ - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); diff --git a/coders/dcm.c b/coders/dcm.c index 94e8e6a8b..15ce5b2f2 100644 --- a/coders/dcm.c +++ b/coders/dcm.c @@ -4091,7 +4091,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) } } if (SetImageGray(image,exception) != MagickFalse) - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", diff --git a/coders/djvu.c b/coders/djvu.c index 66197793f..07286be88 100644 --- a/coders/djvu.c +++ b/coders/djvu.c @@ -645,7 +645,7 @@ static Image *ReadOneDJVUImage(LoadContext* lc,const int pagenum, /* mmc: bitonal should be palettized, and compressed! */ if (type == DDJVU_PAGETYPE_BITONAL){ - image->colorspace = GRAYColorspace; + image->colorspace = sGRAYColorspace; image->storage_class = PseudoClass; image->depth = 8UL; /* i only support that? */ image->colors= 2; diff --git a/coders/dpx.c b/coders/dpx.c index d3e7745c6..8d6a49a4f 100644 --- a/coders/dpx.c +++ b/coders/dpx.c @@ -1203,7 +1203,7 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception) } case LumaComponentType: { - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); break; } default: diff --git a/coders/fits.c b/coders/fits.c index 4e74c980b..aa6d14c7d 100644 --- a/coders/fits.c +++ b/coders/fits.c @@ -432,7 +432,7 @@ static Image *ReadFITSImage(const ImageInfo *image_info, /* Initialize image structure. */ - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); if ((fits_info.min_data == 0.0) && (fits_info.max_data == 0.0)) { if ((fits_info.bits_per_pixel == -32) || diff --git a/coders/gif.c b/coders/gif.c index 0ee58a1b4..ac2575cfd 100644 --- a/coders/gif.c +++ b/coders/gif.c @@ -1347,7 +1347,7 @@ static Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception) if (IsPixelInfoGray(image->colormap+i) == MagickFalse) break; (void) SetImageColorspace(image,i == (ssize_t) image->colors ? - GRAYColorspace : RGBColorspace,exception); + sGRAYColorspace : RGBColorspace,exception); } if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) diff --git a/coders/gray.c b/coders/gray.c index 48f3745c4..f0e57d254 100644 --- a/coders/gray.c +++ b/coders/gray.c @@ -154,7 +154,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, /* Create virtual canvas to support cropping (i.e. image.gray[100x100+10+20]). */ - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse, exception); (void) SetImageVirtualPixelMethod(canvas_image,BlackVirtualPixelMethod, @@ -195,7 +195,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) break; - if (SetImageColorspace(image,GRAYColorspace,exception) == MagickFalse) + if (SetImageColorspace(image,sGRAYColorspace,exception) == MagickFalse) break; if (scene == 0) { diff --git a/coders/ipl.c b/coders/ipl.c index 21b899d63..8ef7e2b61 100644 --- a/coders/ipl.c +++ b/coders/ipl.c @@ -249,7 +249,7 @@ static Image *ReadIPLImage(const ImageInfo *image_info,ExceptionInfo *exception) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); ipl_info.colors=ReadBlobLong(image); if(ipl_info.colors == 3){ SetImageColorspace(image,sRGBColorspace,exception);} - else { image->colorspace = GRAYColorspace; } + else { image->colorspace = sGRAYColorspace; } ipl_info.z=ReadBlobLong(image); ipl_info.time=ReadBlobLong(image); diff --git a/coders/jp2.c b/coders/jp2.c index 1673656de..c4d2558ad 100644 --- a/coders/jp2.c +++ b/coders/jp2.c @@ -409,11 +409,11 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception) return(DestroyImageList(image)); image->compression=JPEG2000Compression; if (jp2_image->numcomps == 1) - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); else if (jp2_image->color_space == 2) { - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); if (jp2_image->numcomps > 1) image->alpha_trait=BlendPixelTrait; } diff --git a/coders/jpeg.c b/coders/jpeg.c index 965b76783..0b300042b 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -1279,7 +1279,7 @@ static Image *ReadJPEGImage(const ImageInfo *image_info, } case JCS_GRAYSCALE: { - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); break; } case JCS_YCbCr: @@ -2253,6 +2253,7 @@ static MagickBooleanType WriteJPEGImage(const ImageInfo *image_info, break; } case GRAYColorspace: + case sGRAYColorspace: { if (image_info->type == TrueColorType) break; @@ -2656,7 +2657,7 @@ static MagickBooleanType WriteJPEGImage(const ImageInfo *image_info, jpeg_info.comp_info[3].v_samp_factor); break; } - case GRAYColorspace: + case sGRAYColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Colorspace: GRAY"); diff --git a/coders/json.c b/coders/json.c index e2566cb93..916af8b93 100644 --- a/coders/json.c +++ b/coders/json.c @@ -1026,7 +1026,7 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, } JSONFormatLocaleFile(file," \"units\": %s,\n",CommandOptionToMnemonic( MagickResolutionOptions,(ssize_t) image->units)); - type=GetImageType(image); + type=IdentifyImageType(image,exception); JSONFormatLocaleFile(file," \"type\": %s,\n",CommandOptionToMnemonic( MagickTypeOptions,(ssize_t) type)); if (image->type != type) @@ -1083,8 +1083,8 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, { (void) PrintChannelLocations(file,image,CyanPixelChannel,"Cyan", type,max_locations,MagickTrue,channel_statistics); - (void) PrintChannelLocations(file,image,MagentaPixelChannel,"Magenta", - type,max_locations,MagickTrue,channel_statistics); + (void) PrintChannelLocations(file,image,MagentaPixelChannel, + "Magenta",type,max_locations,MagickTrue,channel_statistics); (void) PrintChannelLocations(file,image,YellowPixelChannel,"Yellow", type,max_locations,MagickTrue,channel_statistics); (void) PrintChannelLocations(file,image,BlackPixelChannel,"Black", @@ -1092,6 +1092,7 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) PrintChannelLocations(file,image,GrayPixelChannel,"Gray", type,max_locations,MagickFalse,channel_statistics); @@ -1166,6 +1167,7 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) FormatLocaleFile(file," \"gray\": %.20g\n",(double) channel_statistics[GrayChannel].depth); @@ -1181,7 +1183,8 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, { (void) FormatLocaleFile(file," \"pixels\": %.20g,\n", channel_statistics[CompositePixelChannel].area); - if (image->colorspace != GRAYColorspace) + if ((image->colorspace != GRAYColorspace) && + (image->colorspace != sGRAYColorspace)) { (void) FormatLocaleFile(file," \"imageStatistics\": {\n"); (void) PrintChannelStatistics(file,(PixelChannel) MaxPixelChannels, @@ -1218,6 +1221,7 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) PrintChannelStatistics(file,GrayPixelChannel,"Gray",1.0/scale, MagickFalse,channel_statistics); @@ -1260,6 +1264,7 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) PrintChannelMoments(file,GrayPixelChannel,"Gray",MagickFalse, channel_moments); @@ -1310,6 +1315,7 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, break; } case GRAYColorspace: + case sGRAYColorspace: { (void) PrintChannelFeatures(file,GrayPixelChannel,"Gray",MagickFalse, channel_features); diff --git a/coders/mask.c b/coders/mask.c index bec8811d5..c0233c151 100644 --- a/coders/mask.c +++ b/coders/mask.c @@ -237,7 +237,7 @@ static Image *MaskImage(const Image *image,ExceptionInfo *exception) return((Image *) NULL); } mask_image->alpha_trait=UndefinedPixelTrait; - (void) SetImageColorspace(mask_image,GRAYColorspace,exception); + (void) SetImageColorspace(mask_image,sGRAYColorspace,exception); /* Mask image. */ diff --git a/coders/mat.c b/coders/mat.c index d693b1c1c..64d97fdaf 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -686,7 +686,7 @@ static Image *ReadMATImageV4(const ImageInfo *image_info,Image *image, } image->columns=(size_t) HDR.nRows; image->rows=(size_t) HDR.nCols; - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); if (image_info->ping != MagickFalse) { Swap(image->columns,image->rows); @@ -1161,7 +1161,7 @@ RestoreMSCWarning ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) { image->type=GrayscaleType; - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); } diff --git a/coders/palm.c b/coders/palm.c index 120c6dd23..bad62caf1 100644 --- a/coders/palm.c +++ b/coders/palm.c @@ -770,7 +770,7 @@ static MagickBooleanType WritePALMImage(const ImageInfo *image_info, (void) TransformImageColorspace(image,image->colorspace,exception); if (bits_per_pixel < 8) { - (void) TransformImageColorspace(image,GRAYColorspace,exception); + (void) TransformImageColorspace(image,sGRAYColorspace,exception); (void) SetImageType(image,PaletteType,exception); (void) SortColormapByIntensity(image,exception); } diff --git a/coders/pgx.c b/coders/pgx.c index 81165a637..77749c3cb 100644 --- a/coders/pgx.c +++ b/coders/pgx.c @@ -200,7 +200,7 @@ static Image *ReadPGXImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Convert PGX image. */ - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); diff --git a/coders/png.c b/coders/png.c index aa23431a6..de3fbf21f 100644 --- a/coders/png.c +++ b/coders/png.c @@ -3165,7 +3165,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, * image->colorspace to GRAY, and reset image->chromaticity. */ image->intensity = Rec709LuminancePixelIntensityMethod; - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); } else { @@ -3174,7 +3174,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, ChromaticityInfo save_chromaticity = image->chromaticity; - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); image->rendering_intent = save_rendering_intent; image->chromaticity = save_chromaticity; } diff --git a/coders/pnm.c b/coders/pnm.c index 7e2e45c74..a297b8086 100644 --- a/coders/pnm.c +++ b/coders/pnm.c @@ -375,23 +375,23 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) { if (LocaleCompare(value,"BLACKANDWHITE") == 0) { - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); quantum_type=GrayQuantum; } if (LocaleCompare(value,"BLACKANDWHITE_ALPHA") == 0) { - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); image->alpha_trait=BlendPixelTrait; quantum_type=GrayAlphaQuantum; } if (LocaleCompare(value,"GRAYSCALE") == 0) { quantum_type=GrayQuantum; - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); } if (LocaleCompare(value,"GRAYSCALE_ALPHA") == 0) { - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); image->alpha_trait=BlendPixelTrait; quantum_type=GrayAlphaQuantum; } @@ -440,7 +440,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Convert PBM image to pixel packets. */ - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); for (y=0; y < (ssize_t) image->rows; y++) { register ssize_t @@ -483,7 +483,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Convert PGM image to pixel packets. */ - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); for (y=0; y < (ssize_t) image->rows; y++) { register ssize_t @@ -569,7 +569,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Convert PBM raw image to pixel packets. */ - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); quantum_type=GrayQuantum; if (image->storage_class == PseudoClass) quantum_type=IndexQuantum; @@ -632,7 +632,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Convert PGM raw image to pixel packets. */ - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); quantum_type=GrayQuantum; if (image->depth <= 8) extent=image->columns; @@ -1247,7 +1247,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) Convert PFM raster image to pixel packets. */ if (format == 'f') - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); quantum_type=format == 'f' ? GrayQuantum : RGBQuantum; image->endian=quantum_scale < 0.0 ? LSBEndian : MSBEndian; image->depth=32; diff --git a/coders/psd.c b/coders/psd.c index 3f08658ec..add84eea8 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -2084,7 +2084,7 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Image colormap allocated"); } - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); if (psd_info.channels > 1) SetImageAlphaChannel(image,ActivateAlphaChannel,exception); } diff --git a/coders/tiff.c b/coders/tiff.c index 1585dd947..34983a0d4 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -1476,7 +1476,7 @@ RestoreMSCWarning #endif if ((photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); if (photometric == PHOTOMETRIC_SEPARATED) SetImageColorspace(image,CMYKColorspace,exception); if (photometric == PHOTOMETRIC_CIELAB) diff --git a/coders/tile.c b/coders/tile.c index 20758eaae..5fbf76f91 100644 --- a/coders/tile.c +++ b/coders/tile.c @@ -133,7 +133,8 @@ static Image *ReadTILEImage(const ImageInfo *image_info, } (void) TextureImage(image,tile_image,exception); tile_image=DestroyImage(tile_image); - if (image->colorspace == GRAYColorspace) + if ((image->colorspace == GRAYColorspace) || + (image->colorspace == sGRAYColorspace)) image->type=GrayscaleType; return(GetFirstImageInList(image)); } diff --git a/coders/txt.c b/coders/txt.c index f6f671ae3..90cbd2c60 100644 --- a/coders/txt.c +++ b/coders/txt.c @@ -489,6 +489,7 @@ static Image *ReadTXTImage(const ImageInfo *image_info,ExceptionInfo *exception) switch (image->colorspace) { case GRAYColorspace: + case sGRAYColorspace: { if (image->alpha_trait != UndefinedPixelTrait) { @@ -795,7 +796,8 @@ static MagickBooleanType WriteTXTImage(const ImageInfo *image_info,Image *image, (double) x,(double) y); (void) WriteBlobString(image,buffer); (void) CopyMagickString(tuple,"(",MagickPathExtent); - if (pixel.colorspace == GRAYColorspace) + if ((pixel.colorspace == GRAYColorspace) || + (pixel.colorspace == sGRAYColorspace)) ConcatenateColorComponent(&pixel,GrayPixelChannel,compliance,tuple); else { @@ -804,7 +806,8 @@ static MagickBooleanType WriteTXTImage(const ImageInfo *image_info,Image *image, ConcatenateColorComponent(&pixel,GreenPixelChannel,compliance, tuple); (void) ConcatenateMagickString(tuple,",",MagickPathExtent); - ConcatenateColorComponent(&pixel,BluePixelChannel,compliance,tuple); + ConcatenateColorComponent(&pixel,BluePixelChannel,compliance, + tuple); } if (pixel.colorspace == CMYKColorspace) { diff --git a/coders/vicar.c b/coders/vicar.c index 57136e02a..eae7200d9 100644 --- a/coders/vicar.c +++ b/coders/vicar.c @@ -294,7 +294,7 @@ static Image *ReadVICARImage(const ImageInfo *image_info, /* Read VICAR pixels. */ - (void) SetImageColorspace(image,GRAYColorspace,exception); + (void) SetImageColorspace(image,sGRAYColorspace,exception); quantum_type=GrayQuantum; quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) diff --git a/coders/vips.c b/coders/vips.c index 847987058..a473d2f4f 100644 --- a/coders/vips.c +++ b/coders/vips.c @@ -453,7 +453,7 @@ static Image *ReadVIPSImage(const ImageInfo *image_info, break; case VIPSTypeB_W: case VIPSTypeGREY16: - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); if (channels == 2) image->alpha_trait=BlendPixelTrait; break; @@ -672,7 +672,7 @@ static MagickBooleanType WriteVIPSImage(const ImageInfo *image_info, case CMYKColorspace: (void) WriteBlobLong(image,VIPSTypeCMYK); break; - case GRAYColorspace: + case sGRAYColorspace: if (image->depth == 16) (void) WriteBlobLong(image, VIPSTypeGREY16); else diff --git a/coders/xcf.c b/coders/xcf.c index 6dd43348d..2419bfb3d 100644 --- a/coders/xcf.c +++ b/coders/xcf.c @@ -1089,7 +1089,7 @@ static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception) SetImageColorspace(image,sRGBColorspace,exception); else if (image_type == GIMP_GRAY) - SetImageColorspace(image,GRAYColorspace,exception); + SetImageColorspace(image,sGRAYColorspace,exception); else if (image_type == GIMP_INDEXED) ThrowReaderException(CoderError,"ColormapTypeNotSupported"); @@ -1378,7 +1378,7 @@ static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception) if ( image_type == GIMP_GRAY ) { QuantizeInfo qi; GetQuantizeInfo(&qi); - qi.colorspace = GRAYColorspace; + qi.colorspace = sGRAYColorspace; QuantizeImage( &qi, layer_info[j].image ); } }