Changeset 5159 for ImageMagick/trunk/coders/png.c
- Timestamp:
- 09/04/11 18:13:56 (21 months ago)
- File:
-
- 1 edited
-
ImageMagick/trunk/coders/png.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/trunk/coders/png.c
r5158 r5159 7605 7605 ping_need_colortype_warning = MagickFalse; 7606 7606 7607 /* Recognize the ICC sRGB profile and convert it to the sRGB chunk, 7608 * i.e., eliminate the ICC profile and set image->rendering_intent. 7609 * Note that this will not involve any changes to the actual pixels 7610 * but merely passes information to applications that read the resulting 7611 * PNG image. 7612 */ 7613 if (ping_exclude_sRGB == MagickFalse) 7614 { 7615 char 7616 *name; 7617 7618 const StringInfo 7619 *profile; 7620 7621 ResetImageProfileIterator(image); 7622 for (name=GetNextImageProfile(image); name != (const char *) NULL; ) 7623 { 7624 profile=GetImageProfile(image,name); 7625 7626 if (profile != (StringInfo *) NULL) 7627 { 7628 if ((LocaleCompare(name,"ICC") == 0) || 7629 (LocaleCompare(name,"ICM") == 0)) 7630 { 7631 unsigned char 7632 *data; 7633 7634 png_uint_32 7635 length; 7636 7637 { 7638 length=(png_uint_32) GetStringInfoLength(profile); 7639 7640 if (length == 3144) 7641 { 7642 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 7643 " got a 3144-byte ICC profile (potentially sRGB)"); 7644 7645 data=GetStringInfoDatum(profile); 7646 7647 if (data[52]=='s' && data[53]=='R' && 7648 data[54]=='G' && data[55]=='B') 7649 { 7650 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 7651 " It is sRGB)"); 7652 if (image->rendering_intent==UndefinedIntent); 7653 image->rendering_intent=PerceptualIntent; 7654 } 7655 else 7656 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 7657 " It is not sRGB (%c%c%c%c)",data[52], 7658 data[53],data[54],data[55]); 7659 7660 } 7661 else 7662 (void) LogMagickEvent(CoderEvent,GetMagickModule(), 7663 " got a %lu-byte ICC profile", 7664 (unsigned long) length); 7665 } 7666 } 7667 } 7668 name=GetNextImageProfile(image); 7669 } 7670 } 7671 7607 7672 number_opaque = 0; 7608 7673 number_semitransparent = 0; … … 9791 9856 mng_info->write_png_compression_strategy-1); 9792 9857 9793 9794 if ((ping_exclude_tEXt == MagickFalse || ping_exclude_zTXt == MagickFalse) && 9795 (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse)) 9858 /* Only write the iCCP chunk if we are not writing the sRGB chunk. */ 9859 if (ping_exclude_sRGB != MagickFalse || 9860 (image->rendering_intent == UndefinedIntent)) 9861 { 9862 if ((ping_exclude_tEXt == MagickFalse || 9863 ping_exclude_zTXt == MagickFalse) && 9864 (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse)) 9796 9865 { 9797 9866 ResetImageProfileIterator(image); … … 9836 9905 name=GetNextImageProfile(image); 9837 9906 } 9907 } 9838 9908 } 9839 9909 … … 9855 9925 Magick_RenderingIntent_to_PNG_RenderingIntent( 9856 9926 image->rendering_intent))); 9857 9858 if (ping_exclude_gAMA == MagickFalse)9859 png_set_gAMA(ping,ping_info,0.45455);9860 9927 } 9861 9928 }
Note: See TracChangeset
for help on using the changeset viewer.
