From deaaa1f8e824029492ce13fafa110f11c94a5826 Mon Sep 17 00:00:00 2001 From: glennrp Date: Fri, 30 Sep 2011 19:30:49 +0000 Subject: [PATCH] Recognize the ICC sRGB v4 profile and write the PNG sRGB chunk instead. --- coders/png.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/coders/png.c b/coders/png.c index bd0e8d37a..20c186649 100644 --- a/coders/png.c +++ b/coders/png.c @@ -7656,6 +7656,27 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, " It is not sRGB (%c%c%c%c)",data[52], data[53],data[54],data[55]); + } + else if (length == 60960) + { + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + " got a 60960-byte ICC profile (potentially sRGB)"); + + data=GetStringInfoDatum(profile); + + if (data[269]=='s' && data[271]=='R' && + data[273]=='G' && data[275]=='B') + { + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + " It is the ICC v4 sRGB)"); + if (image->rendering_intent==UndefinedIntent) + image->rendering_intent=PerceptualIntent; + } + else + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + " It is not sRGB (%c%c%c%c)", + data[269],data[271],data[273],data[275]); + } else if (length == 3052) { @@ -7674,8 +7695,8 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, } else (void) LogMagickEvent(CoderEvent,GetMagickModule(), - " It is not sRGB (%c%c%c%c)",data[52], - data[53],data[54],data[55]); + " It is not sRGB (%c%c%c%c)",data[336], + data[337],data[338],data[339]); } else -- 2.50.1