From: cristy Date: Thu, 21 Jun 2012 13:02:48 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5375 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7fb2652ba366fc984d1dbb0c66560b91c57dab78;p=imagemagick --- diff --git a/coders/png.c b/coders/png.c index 8d92d1ffb..f3d83d101 100644 --- a/coders/png.c +++ b/coders/png.c @@ -1164,59 +1164,6 @@ static inline ssize_t MagickMin(const ssize_t x,const ssize_t y) return(y); } - - -/* -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % -% I m a g e I s G r a y % -% % -% % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% Like IsImageGray except does not change DirectClass to PseudoClass % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*/ -static MagickBooleanType ImageIsGray(Image *image,ExceptionInfo *exception) -{ - register const Quantum - *p; - - register ssize_t - i, - x, - y; - - assert(image != (Image *) NULL); - assert(image->signature == MagickSignature); - if (image->debug != MagickFalse) - (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - - if (image->storage_class == PseudoClass) - { - for (i=0; i < (ssize_t) image->colors; i++) - if (IsPixelInfoGray(image->colormap+i) == MagickFalse) - return(MagickFalse); - return(MagickTrue); - } - for (y=0; y < (ssize_t) image->rows; y++) - { - p=GetVirtualPixels(image,0,y,image->columns,1,exception); - if (p == (const Quantum *) NULL) - return(MagickFalse); - for (x=(ssize_t) image->columns-1; x >= 0; x--) - { - if (IsPixelGray(image,p) == MagickFalse) - return(MagickFalse); - p+=GetPixelChannels(image); - } - } - return(MagickTrue); -} #endif /* PNG_LIBPNG_VER > 10011 */ #endif /* MAGICKCORE_PNG_DELEGATE */ @@ -8309,6 +8256,9 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, if (mng_info->write_png_colortype != 7) /* We won't need this info */ { ping_have_color=MagickFalse; + if ((IsGrayColorspace(image->colorspace) == MagickFalse) && + (IsRGBColorspace(image->colorspace) == MagickFalse)) + ping_have_color=MagickTrue; ping_have_non_bw=MagickFalse; if(image_colors > 256) @@ -11786,7 +11736,7 @@ static MagickBooleanType WriteOneJNGImage(MngInfo *mng_info, /* Check if image is grayscale. */ if (image_info->type != TrueColorMatteType && image_info->type != - TrueColorType && ImageIsGray(image,exception)) + TrueColorType && IsImageGray(image,exception)) jng_color_type-=2; if (logging != MagickFalse) @@ -12570,7 +12520,7 @@ static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,Image *image, if (need_local_plte == 0) { - if (ImageIsGray(image,exception) == MagickFalse) + if (IsImageGray(image,exception) == MagickFalse) all_images_are_gray=MagickFalse; mng_info->equal_palettes=PalettesAreEqual(image,next_image); if (use_global_plte == 0)