From 6a7ac23af498532443ccbfe1941a140100255502 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Fri, 7 Dec 2018 20:45:16 +0100 Subject: [PATCH] Set attribute when the image contains an acTL chunk to make it possible to detect if the image is APNG. --- coders/png.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/coders/png.c b/coders/png.c index d89e85296..59c7057cc 100644 --- a/coders/png.c +++ b/coders/png.c @@ -1969,6 +1969,8 @@ static int read_user_chunk_callback(png_struct *ping, png_unknown_chunkp chunk) Image *image; + PNGErrorInfo + *error_info; /* The unknown chunk structure contains the chunk data: png_byte name[5]; @@ -1994,9 +1996,6 @@ static int read_user_chunk_callback(png_struct *ping, png_unknown_chunkp chunk) { /* process eXIf or exIf chunk */ - PNGErrorInfo - *error_info; - (void) LogMagickEvent(CoderEvent,GetMagickModule(), " recognized eXIf chunk"); @@ -2069,6 +2068,19 @@ static int read_user_chunk_callback(png_struct *ping, png_unknown_chunkp chunk) return(1); } + /* acTL */ + if ((chunk->name[0] == 97) && (chunk->name[1] == 99) && + (chunk->name[2] == 84) && (chunk->name[3] == 76)) + { + image=(Image *) png_get_user_chunk_ptr(ping); + error_info=(PNGErrorInfo *) png_get_error_ptr(ping); + + (void) SetImageProperty(image,"png:acTL","chunk was found", + error_info->exception); + + return(1); + } + return(0); /* Did not recognize */ } #endif /* PNG_UNKNOWN_CHUNKS_SUPPORTED */ -- 2.40.0