[libpng16] Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option().

This commit is contained in:
Glenn Randers-Pehrson 2014-05-07 12:07:12 -05:00
parent 0d5ac5d809
commit e95ce2c517
6 changed files with 57 additions and 31 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.6.11beta06 - April 26, 2014 Libpng 1.6.11beta06 - May 7, 2014
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -61,7 +61,8 @@ Version 1.6.11beta05 [April 26, 2014]
"Not recognizing known sRGB profile that has been edited" warning for "Not recognizing known sRGB profile that has been edited" warning for
ICC V2 profiles that lack the MD5 signature in the profile header. ICC V2 profiles that lack the MD5 signature in the profile header.
Version 1.6.11beta06 [April 26, 2014] Version 1.6.11beta06 [May 7, 2014]
Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -4912,7 +4912,8 @@ Version 1.6.11beta05 [April 26, 2014]
"Not recognizing known sRGB profile that has been edited" warning for "Not recognizing known sRGB profile that has been edited" warning for
ICC V2 profiles that lack the MD5 signature in the profile header. ICC V2 profiles that lack the MD5 signature in the profile header.
Version 1.6.11beta06 [April 26, 2014] Version 1.6.11beta06 [May 7, 2014]
Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.11beta06 - April 26, 2014 libpng version 1.6.11beta06 - May 7, 2014
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.6.11beta06 - April 26, 2014 libpng versions 0.97, January 1998, through 1.6.11beta06 - May 7, 2014
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -5038,11 +5038,19 @@ Error detection in some chunks has improved; in particular the iCCP chunk
reader now does pretty complete validation of the basic format. Some bad reader now does pretty complete validation of the basic format. Some bad
profiles that were previously accepted are now accepted with a warning or profiles that were previously accepted are now accepted with a warning or
rejected, depending upon the png_set_benign_errors() setting, in particular the rejected, depending upon the png_set_benign_errors() setting, in particular the
very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement very old broken Microsoft/HP 3144-byte sRGB profile. Starting with
that only grayscale profiles may appear in images with color type 0 or 4 and libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
that even if the image only contains gray pixels, only RGB profiles may appear means of
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
is allowed to appear in images with any color type. png_set_option(ping, PNG_SKIP_sRGB_CHECK_PROFILE,
PNG_OPTION_ON);
The PNG spec requirement that only grayscale profiles may appear in images
with color type 0 or 4 and that even if the image only contains gray pixels,
only RGB profiles may appear in images with color type 2, 3, or 6, is now
enforced. The sRGB chunk is allowed to appear in images with any color type
and is interpreted by libpng to convey a one-tracer-curve profile or a
three-tracer-curve profile as appropriate.
Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
an empty language field or an empty translated keyword. Both of these an empty language field or an empty translated keyword. Both of these
@ -5261,7 +5269,7 @@ Other rules can be inferred by inspecting the libpng source.
XVI. Y2K Compliance in libpng XVI. Y2K Compliance in libpng
April 26, 2014 May 7, 2014
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "April 26, 2014" .TH LIBPNG 3 "May 7, 2014"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.11beta06 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.11beta06
.SH SYNOPSIS .SH SYNOPSIS
@ -504,7 +504,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.11beta06 - April 26, 2014 libpng version 1.6.11beta06 - May 7, 2014
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -515,7 +515,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.6.11beta06 - April 26, 2014 libpng versions 0.97, January 1998, through 1.6.11beta06 - May 7, 2014
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -5542,11 +5542,19 @@ Error detection in some chunks has improved; in particular the iCCP chunk
reader now does pretty complete validation of the basic format. Some bad reader now does pretty complete validation of the basic format. Some bad
profiles that were previously accepted are now accepted with a warning or profiles that were previously accepted are now accepted with a warning or
rejected, depending upon the png_set_benign_errors() setting, in particular the rejected, depending upon the png_set_benign_errors() setting, in particular the
very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement very old broken Microsoft/HP 3144-byte sRGB profile. Starting with
that only grayscale profiles may appear in images with color type 0 or 4 and libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
that even if the image only contains gray pixels, only RGB profiles may appear means of
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
is allowed to appear in images with any color type. png_set_option(ping, PNG_SKIP_sRGB_CHECK_PROFILE,
PNG_OPTION_ON);
The PNG spec requirement that only grayscale profiles may appear in images
with color type 0 or 4 and that even if the image only contains gray pixels,
only RGB profiles may appear in images with color type 2, 3, or 6, is now
enforced. The sRGB chunk is allowed to appear in images with any color type
and is interpreted by libpng to convey a one-tracer-curve profile or a
three-tracer-curve profile as appropriate.
Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
an empty language field or an empty translated keyword. Both of these an empty language field or an empty translated keyword. Both of these
@ -5765,7 +5773,7 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVI. Y2K Compliance in libpng .SH XVI. Y2K Compliance in libpng
April 26, 2014 May 7, 2014
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
@ -6062,7 +6070,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.6.11beta06 - April 26, 2014: Libpng version 1.6.11beta06 - May 7, 2014:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -6085,7 +6093,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.11beta06, April 26, 2014, are libpng versions 1.2.6, August 15, 2004, through 1.6.11beta06, May 7, 2014, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -6184,7 +6192,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
April 26, 2014 May 7, 2014
.\" end of man page .\" end of man page

11
png.c
View File

@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.11beta06 - April 26, 2014" PNG_STRING_NEWLINE \ "libpng version 1.6.11beta06 - May 7, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.6.11beta06 - April 26, 2014\ return "libpng version 1.6.11beta06 - May 7, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\ Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -2211,11 +2211,18 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
* by sRGB (but maybe defined by a later ICC specification) the read of * by sRGB (but maybe defined by a later ICC specification) the read of
* the profile will fail at that point. * the profile will fail at that point.
*/ */
/* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */
if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) ==
PNG_OPTION_ON)
return 0;
png_uint_32 length = 0; png_uint_32 length = 0;
png_uint_32 intent = 0x10000; /* invalid */ png_uint_32 intent = 0x10000; /* invalid */
#if PNG_sRGB_PROFILE_CHECKS > 1 #if PNG_sRGB_PROFILE_CHECKS > 1
uLong crc = 0; /* the value for 0 length data */ uLong crc = 0; /* the value for 0 length data */
#endif #endif
unsigned int i; unsigned int i;
for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i) for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i)

13
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.6.11beta06 - April 26, 2014 * libpng version 1.6.11beta06 - May 7, 2014
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.11beta06 - April 26, 2014: Glenn * libpng versions 0.97, January 1998, through 1.6.11beta06 - May 7, 2014: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -227,7 +227,7 @@
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* *
* libpng versions 1.2.6, August 15, 2004, through 1.6.11beta06, April 26, 2014, are * libpng versions 1.2.6, August 15, 2004, through 1.6.11beta06, May 7, 2014, are
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@ -339,7 +339,7 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* April 26, 2014 * May 7, 2014
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
@ -409,7 +409,7 @@
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.11beta06" #define PNG_LIBPNG_VER_STRING "1.6.11beta06"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.11beta06 - April 26, 2014\n" " libpng version 1.6.11beta06 - May 7, 2014\n"
#define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16 #define PNG_LIBPNG_VER_DLLNUM 16
@ -3226,7 +3226,8 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */ # define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
#endif #endif
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */ #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
#define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */ #define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
/* Return values: NOTE: there are four values and 'off' is *not* zero */ /* Return values: NOTE: there are four values and 'off' is *not* zero */
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */