[libpng16] Changed ICC profile support to allow use of an external color

management system (CMS). In practice it is not possible to obtain cHRM
information reliably using just the end-point tags because they do not exist
in the vast majority of profiles.  Instead it is necessary to run the endpoints
through the ICC colorimetric intent transform (as described in the v4
spec).  Since this is likely to be too much code inside libpng for too
little gain (it implies a fairly complete CMS implementation) the code
has been changed to allow an external CMS to be used.  This code is
temporarily disabled until a suitable set of test cases using one or more
external CMS implementations have been implemented.
This commit is contained in:
John Bowler 2012-10-25 19:30:02 -05:00 committed by Glenn Randers-Pehrson
parent e6b710cb3f
commit f8dfd123e2
14 changed files with 821 additions and 944 deletions

View File

@ -528,6 +528,16 @@ Version 1.6.0beta30 [October 24, 2012]
Version 1.6.0beta31 [October 26, 2012]
Undid the erroneous change to vstudio/pngvalid build in libpng-1.6.0beta30.
Made pngvalid so that it will build outside the libpng source tree.
Changed ICC profile support to allow use of an external color management
system (CMS). In practice it is not possible to obtain cHRM information
reliably using just the end-point tags because they do not exist in the
vast majority of profiles. Instead it is necessary to run the endpoints
through the ICC colorimetric intent transform (as described in the v4
spec). Since this is likely to be too much code inside libpng for too
little gain (it implies a fairly complete CMS implementation) the code
has been changed to allow an external CMS to be used. This code is
temporarily disabled until a suitable set of test cases using one or more
external CMS implementations have been implemented.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

10
CHANGES
View File

@ -4280,6 +4280,16 @@ Version 1.6.0beta30 [October 24, 2012]
Version 1.6.0beta31 [October 26, 2012]
Undid the erroneous change to vstudio/pngvalid build in libpng-1.6.0beta30.
Made pngvalid so that it will build outside the libpng source tree.
Changed ICC profile support to allow use of an external color management
system (CMS). In practice it is not possible to obtain cHRM information
reliably using just the end-point tags because they do not exist in the
vast majority of profiles. Instead it is necessary to run the endpoints
through the ICC colorimetric intent transform (as described in the v4
spec). Since this is likely to be too much code inside libpng for too
little gain (it implies a fairly complete CMS implementation) the code
has been changed to allow an external CMS to be used. This code is
temporarily disabled until a suitable set of test cases using one or more
external CMS implementations have been implemented.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

1396
png.c

File diff suppressed because it is too large Load Diff

96
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.6.0beta31 - October 24, 2012
* libpng version 1.6.0beta31 - October 26, 2012
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers:
* 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.97, January 1998, through 1.6.0beta31 - October 24, 2012: Glenn
* libpng versions 0.97, January 1998, through 1.6.0beta31 - October 26, 2012: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -198,7 +198,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.6.0beta31, October 24, 2012, are
* libpng versions 1.2.6, August 15, 2004, through 1.6.0beta31, October 26, 2012, are
* Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -310,7 +310,7 @@
* Y2K compliance in libpng:
* =========================
*
* October 24, 2012
* October 26, 2012
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@ -378,7 +378,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.0beta31"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.0beta31 - October 24, 2012\n"
" libpng version 1.6.0beta31 - October 26, 2012\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@ -3204,6 +3204,90 @@ PNG_EXPORT(242, void, png_set_check_for_invalid_index,
(png_structrp png_ptr, int allowed));
#endif
/*******************************************************************************
* CMS (Color Management System) SUPPORT
*******************************************************************************
*
* The PNG file format supports embedding of ICC profiles, however libpng
* provides only limited support for handling these profiles. In particular
* libpng includes no support for using the profile to transform data into a
* different color space. If PNG_ICC_SUPPORTED is set, however, libpng allows
* an external CMS to be registered into the png_struct after it is created.
* This simply records a single callback function to transform samples between
* two color spaces.
*/
typedef struct png_cms_data *png_cms_datap, * PNG_RESTRICT png_cms_datarp;
/* An opaque type defined by a specific implementation to hold whatever data
* is required. The implementation is responsible for all storage management
* of this data.
*/
typedef PNG_CALLBACK(png_uint_32, *png_cms_transform_ptr,
(png_const_structrp png_ptr, png_cms_datarp data_ptr, png_const_voidp input,
png_alloc_size_t input_bytes, png_voidp output,
png_alloc_size_t output_bytes, int format, int intent));
/* Transform input[input_bytes] of samples to output[output_bytes]. The
* format of the input and output is given by 'format'. The function shall
* transform only so much input as there is space for in the output buffer.
* 'intent' is the ICC intent required for the transformation.
*
* The connection space data (which may be either the input or output) is
* always either 16-bit achromatic data (as described in Annex F.2 of the v4
* ICC specification) for grayscale PNG files or 16-bit PCSXYZ data for RGB
* PNG files. Any alpha channel may be present in the connection space, in
* which case it is a 16-bit channel and the alpha value follows each sample.
* Samples are not pre-multiplied by the alpha. The connection space data
* is stored as an array of png_uint_16 values in the native representation
* of the machine.
*
* For transforms to the connection space the input is in the PNG format
* using either 8-bit or big-endian 16-bit components. 16-bit quantities use
* the PNG layout - big-endian in two bytes.
*
* By default a transform from the connection space will be to 8-bit sRGB
* (with an optional alpha value) or 8-bit gray encoded with the inverse of
* the sRGB transfer function. If png_set_cms_output is called, however, the
* transform may produce arbitrary output in a format potentially not handled
* by libpng.
*
* It is valid to register a CMS when writing a PNG image, however the CMS
* will only be used to generate appropriate values for cHRM and gAMA of the
* profile.
*
* The format parameter is made up of the following flags:
*/
#define PNG_CMS_FORMAT_FLAG_ALPHA 0x01 /* data has alpha channel */
#define PNG_CMS_FORMAT_FLAG_16BIT 0x02 /* 16-bit image components else 8-bit */
#define PNG_CMS_FORMAT_FLAG_PCS 0x04 /* input is PCS data, else image data */
#ifdef PNG_ICC_SUPPORTED
PNG_EXPORT(243, void, png_set_cms, (png_structrp png_ptr,
png_cms_datap cms_data_ptr, png_cms_transform_ptr cms_transform_function));
/* Register the CMS transform function. The given pointer will be passed to
* every call to the function.
*/
#ifdef PNG_READ_SUPPORTED
PNG_EXPORT(244, void, png_set_cms_output, (png_structrp png_ptr,
int bytes_per_pixel, int rendering_intent));
/* Inform libpng that the transform function will write output requiring
* bytes_per_pixel bytes for each sample. The output need not be in any
* particular format, for example the transform could produce a print
* separation. libpng will provide a buffer equal in size to the row width
* of the image times the bytes_per_pixel value (and the application must
* provide this size buffer.)
*
* This also forces the CMS transform to be used even when it is apparently
* not necessary (e.g. for sRGB input data, or for PNG files with no ICC
* profile information and no sRGB data.) The intent overrides the default,
* which is perceptual.
*/
#endif
#endif
/*******************************************************************************
* END OF CMS (Color Management System) SUPPORT
******************************************************************************/
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
* defs
*/
@ -3213,7 +3297,7 @@ PNG_EXPORT(242, void, png_set_check_for_invalid_index,
* scripts/symbols.def as well.
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
PNG_EXPORT_LAST_ORDINAL(242);
PNG_EXPORT_LAST_ORDINAL(244);
#endif
#ifdef __cplusplus

View File

@ -510,6 +510,41 @@ png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
#endif
#endif /* PNG_READ_SUPPORTED */
void /* PRIVATE */
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
{
/* This is always supported, but for just read or just write it
* unconditionally does the right thing.
*/
# if (defined PNG_READ_SUPPORTED) && (defined PNG_WRITE_SUPPORTED)
if (png_ptr->mode & PNG_IS_READ_STRUCT)
# endif
# ifdef PNG_READ_SUPPORTED
{
if (error < PNG_CHUNK_ERROR)
png_chunk_warning(png_ptr, message);
else
png_chunk_benign_error(png_ptr, message);
}
# endif
# if (defined PNG_READ_SUPPORTED) && (defined PNG_WRITE_SUPPORTED)
else if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
# endif
# ifdef PNG_WRITE_SUPPORTED
{
if (error < PNG_CHUNK_WRITE_ERROR)
png_app_warning(png_ptr, message);
else
png_app_error(png_ptr, message);
}
# endif
}
#ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_FUNCTION(void,

View File

@ -1406,9 +1406,12 @@ PNG_INTERNAL_FUNCTION(void,png_do_write_intrapixel,(png_row_infop row_info,
/* Added at libpng version 1.6.0 */
#ifdef PNG_GAMMA_SUPPORTED
PNG_INTERNAL_FUNCTION(int,png_colorspace_set_gamma,(png_const_structrp png_ptr,
png_colorspacerp colorspace, png_fixed_point gAMA, int preferred),
PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY);
/* Set the colorspace gamma with a value provided by the application or by
* the gAMA chunk on read. The value will override anything set by an ICC
* profile.
*/
PNG_INTERNAL_FUNCTION(void,png_colorspace_sync_info,(png_const_structrp png_ptr,
png_inforp info_ptr), PNG_EMPTY);
@ -1436,7 +1439,12 @@ PNG_INTERNAL_FUNCTION(int,png_colorspace_set_endpoints,
#ifdef PNG_sRGB_SUPPORTED
PNG_INTERNAL_FUNCTION(int,png_colorspace_set_sRGB,(png_const_structrp png_ptr,
png_colorspacerp colorspace, int intent, int preferred), PNG_EMPTY);
png_colorspacerp colorspace, int intent), PNG_EMPTY);
/* This does set the colorspace gAMA and cHRM values too, but doesn't set the
* flags to write them, if it returns false there was a problem and an error
* message has already been output (but the colorspace may still need to be
* synced to record the invalid flag).
*/
#endif /* sRGB */
#ifdef PNG_iCCP_SUPPORTED
@ -1459,14 +1467,15 @@ PNG_INTERNAL_FUNCTION(int,png_icc_check_tag_table,(png_const_structrp png_ptr,
png_colorspacerp colorspace, png_const_charp name,
png_uint_32 profile_length,
png_const_bytep profile /* header plus whole tag table */), PNG_EMPTY);
PNG_INTERNAL_FUNCTION(int,png_icc_set_gAMA_and_cHRM,(
PNG_INTERNAL_FUNCTION(void,png_icc_set_gAMA_and_cHRM,(
png_const_structrp png_ptr, png_colorspacerp colorspace,
png_const_charp name, png_const_bytep profile, uLong adler), PNG_EMPTY);
/* 'adler' is the Adler32 checksum of the uncompressed profile data. It may
* be zero to indicate that it is not available. It is used, if provided,
* as a fast check on the profile when checking to see if it is sRGB. The
* result is false only if an error is detected in the profile; the routine
* may return true without actually setting cHRM and gAMA values.
* as a fast check on the profile when checking to see if it is sRGB.
* The routine may not set gAMA or cHRM if there are problems in the profile,
* however none of these problems are fatal (the profile has already been
* checked.)
*/
#endif /* iCCP */
@ -1598,6 +1607,21 @@ PNG_INTERNAL_FUNCTION(void,png_app_error,(png_const_structrp png_ptr,
# define png_app_error(pp,s) png_error(pp,s)
#endif
PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
png_const_charp message, int error),PNG_EMPTY);
/* Report a recoverable issue in chunk data. On read this is used to report
* a problem found while reading a particular chunk and the
* png_chunk_benign_error or png_chunk_warning function is used as
* appropriate. On write this is used to report an error that comes from
* data set via an application call to a png_set_ API and png_app_error or
* png_app_warning is used as appropriate.
*
* The 'error' parameter must have one of the following values:
*/
#define PNG_CHUNK_WARNING 0 /* never an error */
#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
#define PNG_CHUNK_ERROR 2 /* always an error */
/* ASCII to FP interfaces, currently only implemented if sCAL
* support is required.
*/

View File

@ -1087,31 +1087,7 @@ png_handle_gAMA(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
igamma = png_get_fixed_point(NULL, buf);
/* The gAMA value is unsigned (and is a power law correction, so 0 is
* meaningless.)
*/
if (igamma <= 0)
{
png_chunk_benign_error(png_ptr, "out of range");
return;
}
/* If a colorspace error has already been output skip this chunk */
if (png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID)
return;
if (png_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA)
{
png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
png_colorspace_sync(png_ptr, info_ptr);
png_chunk_benign_error(png_ptr, "duplicate");
return;
}
png_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_gAMA;
(void)png_colorspace_set_gamma(png_ptr, &png_ptr->colorspace, igamma,
1/*prefer gAMA values*/);
png_colorspace_set_gamma(png_ptr, &png_ptr->colorspace, igamma);
png_colorspace_sync(png_ptr, info_ptr);
}
#endif
@ -1285,13 +1261,6 @@ png_handle_sRGB(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if (png_crc_finish(png_ptr, 0))
return;
/* Check for bad intent */
if (intent >= PNG_sRGB_INTENT_LAST)
{
png_chunk_benign_error(png_ptr, "Unknown sRGB intent");
return;
}
/* If a colorspace error has already been output skip this chunk */
if (png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID)
return;
@ -1307,16 +1276,7 @@ png_handle_sRGB(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
return;
}
/* Do not override gAMA or cHRM from the PNG file; just check they match.
* This is because we write a cHRM which corresponds to D65, however there is
* an issue with CMMs that assume a D50 environment that requires adaptation
* of the white point. This way at least it is possible to supply an
* adapated value (so long as it is within the tolerance limits for a match
* against the D65 chromaticities.)
*
* TODO: get expert opinions on this issue
*/
(void)png_colorspace_set_sRGB(png_ptr, &png_ptr->colorspace, intent, 0);
png_colorspace_set_sRGB(png_ptr, &png_ptr->colorspace, intent);
png_colorspace_sync(png_ptr, info_ptr);
}
#endif /* PNG_READ_sRGB_SUPPORTED */
@ -1475,8 +1435,6 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
/* But otherwise allow extra data: */
else if (size == 0)
{
int ok;
if (length > 0)
{
/* This can be handled completely, so
@ -1493,12 +1451,12 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
* checks for a known sRGB profile. The
* result is 0 on error.
*/
ok = png_icc_set_gAMA_and_cHRM(png_ptr,
png_icc_set_gAMA_and_cHRM(png_ptr,
&png_ptr->colorspace, keyword, profile,
png_ptr->zstream.adler);
/* Steal the profile for info_ptr. */
if (ok && info_ptr != NULL)
if (info_ptr != NULL)
{
png_free_data(png_ptr, info_ptr,
PNG_FREE_ICCP, 0);
@ -1534,15 +1492,11 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if (info_ptr != NULL)
png_colorspace_sync(png_ptr, info_ptr);
if (errmsg == NULL && ok)
if (errmsg == NULL)
{
png_ptr->zowner = 0;
return;
}
/* else png_icc_set_gAMA_and_cHRM has
* already output an error.
*/
}
else if (size > 0)

View File

@ -143,25 +143,8 @@ png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
/* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
* occur. Since the fixed point representation is assymetrical it is
* possible for 1/gamma to overflow the limit of 21474 and this means the
* gamma value must be at least 5/100000 and hence at most 20000.0. For
* safety the limits here are a little narrower. The values are 0.00016 to
* 6250.0, which are truly ridiculous gamma values (and will produce
* displays that are all black or all white.)
*/
if (file_gamma < 16 || file_gamma > 625000000)
png_app_error(png_ptr, "Out of range gamma value ignored");
else
{
if (png_colorspace_set_gamma(png_ptr, &info_ptr->colorspace, file_gamma,
2/* overrided with app value */))
info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_gAMA;
png_colorspace_sync_info(png_ptr, info_ptr);
}
png_colorspace_set_gamma(png_ptr, &info_ptr->colorspace, file_gamma);
png_colorspace_sync_info(png_ptr, info_ptr);
}
# ifdef PNG_FLOATING_POINT_SUPPORTED
@ -595,9 +578,7 @@ png_set_sRGB(png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)
if (png_ptr == NULL || info_ptr == NULL)
return;
(void)png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent,
2/* app value overrides*/);
png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent);
png_colorspace_sync_info(png_ptr, info_ptr);
}
@ -610,10 +591,9 @@ png_set_sRGB_gAMA_and_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent,
2/* app value overrides*/))
if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent))
{
/* And cause the gAMA and cHRM to be written too */
/* This causes the gAMA and cHRM to be written too */
info_ptr->colorspace.flags |=
PNG_COLORSPACE_FROM_gAMA|PNG_COLORSPACE_FROM_cHRM;
}
@ -1570,4 +1550,34 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
}
#endif
#ifdef PNG_ICC_SUPPORTED
void PNGAPI
png_set_cms(png_structrp png_ptr, png_cms_datap cms_data_ptr,
png_cms_transform_ptr cms_transform_function)
{
png_ptr->cms_transform_fn = cms_transform_function;
png_ptr->cms_data_ptr = cms_data_ptr;
}
#ifdef PNG_READ_SUPPORTED
void PNGAPI
png_set_cms_output(png_structrp png_ptr, int bytes_per_pixel,
int rendering_intent)
{
if (png_ptr->mode & PNG_IS_READ_STRUCT)
{
png_ptr->cms_bytes_per_pixel = bytes_per_pixel;
png_ptr->cms_intent = rendering_intent;
/* A CMS must be registered before calling this */
if (png_ptr->cms_transform_fn == NULL)
png_app_error(png_ptr, "no CMS registered to transform output");
}
else
png_app_error(png_ptr, "attempt to do CMS tranform on write");
}
#endif /* PNG_READ_SUPPORTED */
#endif /* PNG_ICC_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

View File

@ -203,8 +203,9 @@ typedef const png_colorspace * PNG_RESTRICT png_const_colorspacerp;
#define PNG_COLORSPACE_HAVE_INTENT 0x0004
#define PNG_COLORSPACE_FROM_gAMA 0x0008
#define PNG_COLORSPACE_FROM_cHRM 0x0010
#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0020
#define PNG_COLORSPACE_MATCHES_sRGB 0x0040 /* exact match on profile */
#define PNG_COLORSPACE_FROM_sRGB 0x0020
#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
#define PNG_COLORSPACE_MATCHES_sRGB 0x0080 /* exact match on profile */
#define PNG_COLORSPACE_INVALID 0x8000
#define PNG_COLORSPACE_CANCEL(flags) (0xffff ^ (flags))
#endif /* COLORSPACE || GAMMA */
@ -547,5 +548,17 @@ struct png_struct_def
png_colorspace colorspace;
#endif
#endif
#ifdef PNG_ICC_SUPPORTED
/* Full ICC support requires an external CMS be registered in the png_struct
* after it is created. The registration stores this information.
*/
png_cms_transform_ptr cms_transform_fn;
png_cms_datap cms_data_ptr;
#ifdef PNG_READ_SUPPORTED
int cms_bytes_per_pixel; /* non-standard output size */
int cms_intent; /* for non-standard output */
#endif
#endif /* PNG_ICC_SUPPORTED */
};
#endif /* PNGSTRUCT_H */

View File

@ -29,23 +29,6 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
buf[3] = (png_byte)(i & 0xff);
}
#ifdef PNG_SAVE_INT_32_SUPPORTED
/* The png_save_int_32 function assumes integers are stored in two's
* complement format. If this isn't the case, then this routine needs to
* be modified to write data in two's complement format. Note that,
* the following works correctly even if png_int_32 has more than 32 bits
* (compare the more complex code required on read for sign extention.)
*/
void PNGAPI
png_save_int_32(png_bytep buf, png_int_32 i)
{
buf[0] = (png_byte)((i >> 24) & 0xff);
buf[1] = (png_byte)((i >> 16) & 0xff);
buf[2] = (png_byte)((i >> 8) & 0xff);
buf[3] = (png_byte)(i & 0xff);
}
#endif
/* Place a 16-bit number into a buffer in PNG byte order.
* The parameter is declared unsigned int, not png_uint_16,
* just to avoid potential problems on pre-ANSI C compilers.

View File

@ -478,6 +478,20 @@ option WRITE_TEXT requires WRITE_ANCILLARY_CHUNKS enables TEXT
option GAMMA disabled
option COLORSPACE enables GAMMA disabled
# ICC profile support; basic ICC profile support is enabled if iCCP chunk read
# or write is enabled. The application must perform all iCCP profile handling
# itself. If full support is enabled with the option below libpng will attempt
# to do more processing using the profile data itself, this includes setting
# appropriate values for cHRM and gAMA chunks if not present in the stream.
#
# ICC profile support is not build in to core libpng because of the size of the
# code required; an external ICC implementation must be passed to libpng to
# enable it.
#
# WARNING: this option is CURRENTLY UNTESTED because a test CMS implementation
# has not yet been written, as a result it is disabled in current beta builds.
option ICC requires iCCP enables SAVE_INT_32 disabled
# When an ICC profile is read, or png_set, it will be checked for a match
# against known sRGB profiles if the sRGB handling is enabled. This
# setting controls how much work is done during the check:
@ -694,9 +708,10 @@ option CONVERT_tIME requires WRITE_ANCILLARY_CHUNKS
option WRITE_FILTER requires WRITE
option SAVE_INT_32 requires WRITE
# png_save_int_32 is required by the ancillary chunks oFFs and pCAL
option SAVE_INT_32 disabled
# png_save_int_32 is required internally for writing the ancillary chunks oFFs
# and pCAL and for both reading and writing iCCP (for the generation/checking of
# the corresponding cHRM/gAMA chunks) if full ICC is supported.
# added at libpng-1.5.4

View File

@ -3,7 +3,7 @@
/* pnglibconf.h - library build configuration */
/* Libpng 1.6.0beta31 - October 24, 2012 */
/* Libpng 1.6.0beta31 - October 26, 2012 */
/* Copyright (c) 1998-2012 Glenn Randers-Pehrson */
@ -63,6 +63,7 @@
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED
/*#undef PNG_ICC_SUPPORTED*/
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED

View File

@ -205,7 +205,6 @@ EXPORTS
png_get_y_offset_inches @197
png_get_pHYs_dpi @198
png_get_io_state @199
;png_get_io_chunk_name @200
png_get_uint_32 @201
png_get_uint_16 @202
png_get_int_32 @203
@ -248,3 +247,5 @@ EXPORTS
png_image_write_to_stdio @240
png_convert_to_rfc1123_buffer @241
png_set_check_for_invalid_index @242
png_set_cms @243
png_set_cms_output @244

View File

@ -42,6 +42,7 @@
#define PNG_READ_BIG_ENDIAN_SUPPORTED /* should do nothing! */
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
#define PNG_ICC_SUPPORTED /* currently disabled */
#undef PNG_H
#include "../png.h"