]> granicus.if.org Git - imagemagick/commitdiff
Introducing the sGray (non-linear grayscale) colorspace
authorCristy <urban-warrior@imagemagick.org>
Sun, 24 Dec 2017 14:34:52 +0000 (09:34 -0500)
committerCristy <urban-warrior@imagemagick.org>
Sun, 24 Dec 2017 14:34:52 +0000 (09:34 -0500)
51 files changed:
MagickCore/accelerate-kernels-private.h
MagickCore/accelerate.c
MagickCore/attribute.c
MagickCore/channel.c
MagickCore/color.c
MagickCore/colorspace-private.h
MagickCore/colorspace.c
MagickCore/colorspace.h
MagickCore/delegate.c
MagickCore/effect.c
MagickCore/enhance.c
MagickCore/feature.c
MagickCore/identify.c
MagickCore/image.c
MagickCore/matrix.c
MagickCore/option.c
MagickCore/paint.c
MagickCore/pixel.c
MagickCore/profile.c
MagickCore/property.c
MagickCore/quantize.c
MagickWand/animate.c
MagickWand/compare.c
MagickWand/display.c
MagickWand/import.c
MagickWand/magick-image.c
MagickWand/operation.c
coders/art.c
coders/dcm.c
coders/djvu.c
coders/dpx.c
coders/fits.c
coders/gif.c
coders/gray.c
coders/ipl.c
coders/jp2.c
coders/jpeg.c
coders/json.c
coders/mask.c
coders/mat.c
coders/palm.c
coders/pgx.c
coders/png.c
coders/pnm.c
coders/psd.c
coders/tiff.c
coders/tile.c
coders/txt.c
coders/vicar.c
coders/vips.c
coders/xcf.c

index 717d52bc70acbf056e262d33d489c02b0807575f..9d785f4bbea51bf34762f920e26dadbd8caa752b 100644 (file)
@@ -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)
index c2c20728a1fbe1ad92c4ecf4801ff44084706d8e..86c9e16732c65848ed7b54a8c2e9e7dd51aa7a75 100644 (file)
@@ -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;
index 94daad82946bb7e3cf6e4e3fcf8ae510bb00b887..edf451dfc2a2a2d6d5a1a48b0eae97a181633b01 100644 (file)
@@ -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;
index dd48e600791bb19648798ad101aa6fe6c0b1bbb8..03d3f04b4e95664a3bce6bbf4ec957276ad543cf 100644 (file)
@@ -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.
index c9f7578ba0267208d42f98d1229f47f28b28746b..ee1e4eb87d980ce9665df511734c9d034bb98564 100644 (file)
@@ -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) &&
index 94a6c5d8b077706913f5fa06c06e86da3a04123d..7e15e0ad1d121dc286de6cb6fbd2dc8d64a72a12 100644 (file)
@@ -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);
 }
index 961240a5ee8da803a09653cf8122d0eb7d388041..45c443112ade0a803e8d938fe46a89b7e8a9b90e 100644 (file)
@@ -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);
 }
 \f
@@ -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.
index 849768bd5e86b73ecd537c1165ed90aa21205e89..3bf3de0e3dd381764db2fddbfb291263bffbffe4 100644 (file)
@@ -56,7 +56,8 @@ typedef enum
   YDbDrColorspace,
   YIQColorspace,
   YPbPrColorspace,
-  YUVColorspace
+  YUVColorspace,
+  sGRAYColorspace
 } ColorspaceType;
 
 extern MagickExport ColorspaceType
index f1bd613e2cda06e5e09e4978eb55e433d24d6ad2..f4ef6011b592b4acf481ba40a8e8aef6c3157b4f 100644 (file)
@@ -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,
index 0b004020ed8a724ddc2821fef8068376ce3903fe..ba870dc03adea88f3fd4282ad5ee468de318cb27 100644 (file)
@@ -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);
index f1663cd56ab2780165ef371c31e16a2187da77d8..b7532b006a8ca02e509dc5a37838e2c7cf0fe8dd 100644 (file)
@@ -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));
 }
 \f
 /*
index 6dda2b89cd921d6abb7f417363d107d301595062..3bac61af2e6195f5453d28cb31dbc4909deeefdc 100644 (file)
@@ -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);
index a372549c5aa5a8213132a4632a52e864bea1df28..7eaa54a1096cda055ba9be1f70f76e48ed2b689e 100644 (file)
@@ -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);
index f61292786279df6daead5a0b1362eed2bf871dd3..f33ec40e84c1b90bfe3fb11720c75af7cbcbf9b4 100644 (file)
@@ -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);
index 74b9f33b07cb9b7e5721b4c7703dedd38d0b1938..116f81cb28f68a8ea02cfb4f79089e75574514a8 100644 (file)
@@ -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)
index d81e2d7c236a422fc089b258c5f4305acdf9d237..7b019c32b154045d0580bf5a4f446ba18853fda2 100644 (file)
@@ -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 },
index 05928fd0c2bb1a6c21eabdd98371555f307344e7..3557f9b99a3e88e71c99f9334d9dd7bbadb203cb 100644 (file)
@@ -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);
index 919e4510d3a0d3519cabc490d9465148e9ea4fef..d76a8dba1d0777fbceaab603f83122679e7554d4 100644 (file)
@@ -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;
       }
index 490a809f35b08d77078a82be8a1a5be818129d3c..42f3b6bc4abf0ed1cde788c5c765e9deb9387bc3 100644 (file)
@@ -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);
index b1fcd649e85ed8c97867ed34f5eb5f9a8db8997a..079e952d510a0090db3ebda5e98c770ba1ade935 100644 (file)
@@ -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,
index 660b7f8b1ec17dc3f45734e60e61925b1fa35dca..bb21f870b8d75d0891d01c37456c5ce7fa768baf 100644 (file)
@@ -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)
index 6758f04dbf1cef60ed3bd086076c27a209f94220..dd6ab545d83a1cad1b0a40d26ba82feeb1474e2e 100644 (file)
@@ -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);
index 524af96306bc2838683216903ee82367fcdb315a..6920f998f2fa7cd72f1407ce86d70ee3762bd11f 100644 (file)
@@ -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]);
index 784446397ebbae0782b2d0a3b0bc0f0a8de8eb98..69f7a602b683904d89c8971c49e13eddaed17844 100644 (file)
@@ -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);
index be13c14a119683ff0a832b58fe9088bc773705a0..cdd7821325ea0864b222e880ccacf5f44d6fefec 100644 (file)
@@ -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);
index 7f5d2318be67c98468edaa170f2f9ccc85fd13a4..aa5990b83d25da98d72a79b44742f25ecb411f0a 100644 (file)
@@ -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,
index 76748d703effe49d8dec1901600b153909b7f9e6..f0273d1c8db10fbdfbd9d2459c9e7372f57b147c 100644 (file)
@@ -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;
index 3feb9939651908c24500f99506528786ab2cb628..fbd2c86de581a47bd62a3d7f432138c3bc091a6f 100644 (file)
@@ -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");
index 94e8e6a8b1ce89f1dbc99aa29f9ba1f2ca468793..15ce5b2f2142dcf3dea333a8a75bf826ddeb4e87 100644 (file)
@@ -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",
index 66197793ff67114af95c03ead8ed5aeba01bd5bd..07286be880d9cbb35b3473180e5794977937c336 100644 (file)
@@ -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;
index d3e7745c6060e46a76dc366a190dd0e464021dcb..8d6a49a4f4e9c55e0778a7f4e0f1c30529795700 100644 (file)
@@ -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:
index 4e74c980b20989e96b9cd2a19b1d49c924538e8f..aa6d14c7d84b0f962e873ea62a8a7a903d860119 100644 (file)
@@ -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) ||
index 0ee58a1b4982f06c4a7223e5b7108161a0e7933d..ac2575cfddb3152e3b26a15684e499fe42e3589c 100644 (file)
@@ -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))
index 48f3745c4c5330f83ebc0854d31704633c7790c4..f0e57d2547883688455d8390b275e1a45f491732 100644 (file)
@@ -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)
       {
index 21b899d638d41e533689553ee5a289a02e4146df..8ef7e2b6137062e91320526cba09c72a8c55ba1b 100644 (file)
@@ -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); 
 
index 1673656dee85d8c62ff5eafbd4d1c3dbd8132783..c4d2558ad8cbd58c56f7ab11ec90f05a1f89effd 100644 (file)
@@ -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;
       }
index 965b76783313d54088c4224b8880ffb7b8a2b8f2..0b300042bc6b0fa67fceac626d12fb201a82c9c8 100644 (file)
@@ -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");
index e2566cb93af731931d0ea73b9dad5a2485d5e8d2..916af8b93a855d967a5341162c0e213927463205 100644 (file)
@@ -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);
index bec8811d5ad661a8f83ffc0bd641494d2441d4ed..c0233c151bff9f62c256e4c156d26c710afe6d40 100644 (file)
@@ -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.
   */
index d693b1c1c19826f74be3a358c624f200f9cc16ed..64d97fdafd5d8bee64948b8be815a33ea6eb0c95 100644 (file)
@@ -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);
       }
 
 
index 120c6dd2312e99f13c9ddd09d224d9aa37110a1f..bad62caf1db86b25e99e901bcb82689ecb814a02 100644 (file)
@@ -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);
       }
index 81165a63758a24b6538210191b8f12a37c27de50..77749c3cbc4617e0c580276066930154b87340f5 100644 (file)
@@ -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");
index aa23431a60455d3aec50d0fac23015ccab48ed79..de3fbf21fa0a87e73c10b94e018842397c0dc145 100644 (file)
@@ -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;
         }
index 7e2e45c74a085dac8c8501c320e8751944c440b8..a297b8086fa952afc60d696a757f0edb58e3fcb2 100644 (file)
@@ -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;
index 3f08658ec27f60736e63bec6302e0e13cf1f69b8..add84eea8990824cdb3b79c0811830625ed00ceb 100644 (file)
@@ -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);
     }
index 1585dd947b0d594266d525512197fa0827ea064c..34983a0d4b528b927c6c19685ba05d90931c4945 100644 (file)
@@ -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)
index 20758eaaea095c3b70a81336c329ec866bd03046..5fbf76f917d3f581b59b1bdc28a2f8fe9649e89f 100644 (file)
@@ -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));
 }
index f6f671ae38b53d4d7d06b47b43d2378b833036d2..90cbd2c60e7b68f41d0b0c00c340aaa487bba01e 100644 (file)
@@ -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)
           {
index 57136e02ad5effff7c213d9ca944138b11bc63a0..eae7200d9a50fd6410be66d2f9056705637d9f48 100644 (file)
@@ -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)
index 84798705851eab544c2262e2c97f3477b2bd136f..a473d2f4f6c536e303cffa38d09954f9d54fe4c0 100644 (file)
@@ -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
index 6dd43348d5ca1534046f1e0418fc88d646ec142f..2419bfb3dc197f4b83362530aa6552af330df1c3 100644 (file)
@@ -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 );
             }
           }