From 3e37b4a7f21b6ae84f32c7748d999d86e17c201a Mon Sep 17 00:00:00 2001 From: glennrp Date: Mon, 7 Mar 2011 01:06:55 +0000 Subject: [PATCH] Also skip text:density chunk found in a PNG datastream by the PNG decoder, if a pHYs chunk is also present. --- ChangeLog | 2 ++ coders/png.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 19b0f9626..0e7174d17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ * Don't write a PNG text chunk with "density" keyword that overrides the PNG pHYs chunk, if the pHYs chunk was not excluded (reference http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=18225). + * Ignore any PNG text chunk with a "density" keyword found by the PNG + decoder, if the PNG datastream also contains a pHYs chunk. 2011-03-06 6.6.8-2 Cristy * Support the Radiance HDR image format. diff --git a/coders/png.c b/coders/png.c index be876ef8f..9f5dda628 100644 --- a/coders/png.c +++ b/coders/png.c @@ -2882,7 +2882,11 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, } *value='\0'; (void) ConcatenateMagickString(value,text[i].text,length+2); - (void) SetImageProperty(image,text[i].key,value); + + /* Don't save "density" property if we have a pHYs chunk */ + if (LocaleCompare(text[i].key,"density") != 0 || + !png_get_valid(ping,ping_info,PNG_INFO_pHYs)) + (void) SetImageProperty(image,text[i].key,value); if (logging != MagickFalse) { -- 2.49.0