return(status);
}
case LinearGRAYColorspace:
+ {
+ /*
+ Transform image from sRGB to GRAY.
+ */
+ if (image->storage_class == PseudoClass)
+ {
+ if (SyncImage(image,exception) == MagickFalse)
+ return(MagickFalse);
+ if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
+ return(MagickFalse);
+ }
+ image_view=AcquireAuthenticCacheView(image,exception);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(static) shared(status) \
+ magick_number_threads(image,image,image->rows,1)
+#endif
+ for (y=0; y < (ssize_t) image->rows; y++)
+ {
+ MagickBooleanType
+ sync;
+
+ register ssize_t
+ x;
+
+ register Quantum
+ *magick_restrict q;
+
+ if (status == MagickFalse)
+ continue;
+ q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
+ exception);
+ if (q == (Quantum *) NULL)
+ {
+ status=MagickFalse;
+ continue;
+ }
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ MagickRealType
+ gray;
+
+ gray=(MagickRealType) GetPixelIntensity(image,q);
+ SetPixelGray(image,ClampToQuantum(DecodePixelGamma(gray)),q);
+ q+=GetPixelChannels(image);
+ }
+ sync=SyncCacheViewAuthenticPixels(image_view,exception);
+ if (sync == MagickFalse)
+ status=MagickFalse;
+ }
+ image_view=DestroyCacheView(image_view);
+ if (SetImageColorspace(image,colorspace,exception) == MagickFalse)
+ return(MagickFalse);
+ image->type=GrayscaleType;
+ return(status);
+ }
case GRAYColorspace:
{
/*
return(status);
}
case LinearGRAYColorspace:
+ {
+ /*
+ Transform linear GRAY to sRGB colorspace.
+ */
+ if (image->storage_class == PseudoClass)
+ {
+ if (SyncImage(image,exception) == MagickFalse)
+ return(MagickFalse);
+ if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
+ return(MagickFalse);
+ }
+ if (SetImageColorspace(image,sRGBColorspace,exception) == MagickFalse)
+ return(MagickFalse);
+ image_view=AcquireAuthenticCacheView(image,exception);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(static) shared(status) \
+ magick_number_threads(image,image,image->rows,1)
+#endif
+ for (y=0; y < (ssize_t) image->rows; y++)
+ {
+ MagickBooleanType
+ sync;
+
+ register ssize_t
+ x;
+
+ register Quantum
+ *magick_restrict q;
+
+ if (status == MagickFalse)
+ continue;
+ q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
+ exception);
+ if (q == (Quantum *) NULL)
+ {
+ status=MagickFalse;
+ continue;
+ }
+ for (x=(ssize_t) image->columns; x != 0; x--)
+ {
+ MagickRealType
+ gray;
+
+ gray=(MagickRealType) GetPixelIntensity(image,q);
+ SetPixelGray(image,ClampToQuantum(EncodePixelGamma(gray)),q);
+ q+=GetPixelChannels(image);
+ }
+ sync=SyncCacheViewAuthenticPixels(image_view,exception);
+ if (sync == MagickFalse)
+ status=MagickFalse;
+ }
+ image_view=DestroyCacheView(image_view);
+ if (SetImageColorspace(image,sRGBColorspace,exception) == MagickFalse)
+ return(MagickFalse);
+ return(status);
+ }
case GRAYColorspace:
{
/*