libpng: update to 1.6.46

arm-master
pedro 9 months ago
parent aa515ff1ce
commit 2affec0147

@ -41,7 +41,7 @@ indent_style = space
max_doc_length = 100
max_line_length = 100
[{Makefile.in,ltmain.sh}]
[{Makefile.in,aclocal.m4,ltmain.sh}]
indent_size = unset
indent_style = unset
insert_final_newline = unset

@ -1,5 +1,5 @@
libpng 1.6.45 - January 7, 2025
===============================
libpng 1.6.46 - January 23, 2025
================================
This is a public release of libpng, intended for use in production code.
@ -9,13 +9,13 @@ Files available for download
Source files with LF line endings (for Unix/Linux):
* libpng-1.6.45.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.45.tar.gz (deflate-compressed)
* libpng-1.6.46.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.46.tar.gz (deflate-compressed)
Source files with CRLF line endings (for Windows):
* lpng1645.7z (LZMA-compressed, recommended)
* lpng1645.zip (deflate-compressed)
* lpng1646.7z (LZMA-compressed, recommended)
* lpng1646.zip (deflate-compressed)
Other information:
@ -25,18 +25,17 @@ Other information:
* TRADEMARK.md
Changes from version 1.6.44 to version 1.6.45
Changes from version 1.6.45 to version 1.6.46
---------------------------------------------
* Added support for the cICP chunk.
(Contributed by Lucas Chollet and John Bowler)
* Adjusted and improved various checks in colorspace calculations.
* Added support for the mDCV and cLLI chunks.
(Contributed by John Bowler)
* Rearranged the write order of colorspace chunks for better conformance
with the PNG v3 draft specification.
* Fixed a build issue affecting C89 compilers.
This was a regression introduced in libpng-1.6.45.
(Contributed by John Bowler)
* Raised the minimum required CMake version from 3.6 to 3.14.
* Forked off a development branch for libpng version 1.8.
* Added makefile.c89, specifically for testing C89 compilers.
* Cleaned up contrib/pngminus: corrected an old typo, removed an old
workaround, and updated the CMake file.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.

@ -6229,6 +6229,16 @@ Version 1.6.45 [January 7, 2025]
Raised the minimum required CMake version from 3.6 to 3.14.
Forked off a development branch for libpng version 1.8.
Version 1.6.46 [January 23, 2025]
Added support for the mDCV and cLLI chunks.
(Contributed by John Bowler)
Fixed a build issue affecting C89 compilers.
This was a regression introduced in libpng-1.6.45.
(Contributed by John Bowler)
Added makefile.c89, specifically for testing C89 compilers.
Cleaned up contrib/pngminus: corrected an old typo, removed an old
workaround, and updated the CMake file.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

@ -18,7 +18,7 @@ cmake_minimum_required(VERSION 3.14)
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6)
set(PNGLIB_REVISION 45)
set(PNGLIB_REVISION 46)
set(PNGLIB_SUBREVISION 0)
#set(PNGLIB_SUBREVISION "git")
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_REVISION})

@ -1,6 +1,6 @@
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
#
# Copyright (c) 2018-2024 Cosmin Truta
# Copyright (c) 2018-2025 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
@ -199,7 +199,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
# PNG_COPTS give extra options for the C compiler to be used on all compilation
# steps (unless targe_CFLAGS is specified; that will take precedence over
# steps (unless target_CFLAGS is specified; that will take precedence over
# AM_CFLAGS)
PNG_COPTS = @PNG_COPTS@
AM_CFLAGS = ${PNG_COPTS}

@ -16,7 +16,7 @@
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
#
# Copyright (c) 2018-2024 Cosmin Truta
# Copyright (c) 2018-2025 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
@ -687,7 +687,7 @@ PNGLIB_RELEASE = @PNGLIB_RELEASE@
PNGLIB_VERSION = @PNGLIB_VERSION@
# PNG_COPTS give extra options for the C compiler to be used on all compilation
# steps (unless targe_CFLAGS is specified; that will take precedence over
# steps (unless target_CFLAGS is specified; that will take precedence over
# AM_CFLAGS)
PNG_COPTS = @PNG_COPTS@
PNG_PREFIX = @PNG_PREFIX@

@ -1,4 +1,4 @@
README for libpng version 1.6.45
README for libpng version 1.6.46
================================
See the note about version numbers near the top of `png.h`.

@ -899,7 +899,7 @@ am_cv_filesystem_timestamp_resolution=2
# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
# - 1 sec is not much of a win compared to 2 sec, and
# - it takes 2 seconds to perform the test whether 1 sec works.
#
#
# Instead, just use the default 2s on platforms that have 1s resolution,
# accept the extra 1s delay when using $sleep in the Automake tests, in
# exchange for not incurring the 2s delay for running the test for all
@ -972,7 +972,7 @@ for am_try_res in $am_try_resolutions; do
# everything else supports the subsecond mtimes, but make doesn't;
# notably on macOS, which ships make 3.81 from 2006 (the last one
# released under GPLv2). https://bugs.gnu.org/68808
#
#
# We test $MAKE if it is defined in the environment, else "make".
# It might get overridden later, but our hope is that in practice
# it does not matter: it is the system "make" which is (by far)

@ -0,0 +1,25 @@
Scripts for the Continuous Integration of the PNG Reference Library
===================================================================
Copyright Notice
----------------
Copyright (c) 2019-2024 Cosmin Truta.
Use, modification and distribution are subject to the MIT License.
Please see the accompanying file `LICENSE_MIT.txt` or visit
https://opensource.org/license/mit
File List
---------
LICENSE_MIT.txt ==> The License file
README.md ==> This file
ci_lint.sh ==> Lint the source code
ci_shellify.sh ==> Convert select definitions to shell syntax
ci_verify_cmake.sh ==> Verify the build driven by CMakeLists.txt
ci_verify_configure.sh ==> Verify the build driven by configure
ci_verify_makefiles.sh ==> Verify the build driven by scripts/makefile.*
ci_verify_version.sh ==> Verify the consistency of version definitions
lib/ci.lib.sh ==> Shell utilities for the main ci_*.sh scripts
targets/*/ci_env.*.sh ==> Shell environments for cross-platform testing

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for libpng 1.6.45.
# Generated by GNU Autoconf 2.72 for libpng 1.6.46.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
@ -614,8 +614,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
PACKAGE_VERSION='1.6.45'
PACKAGE_STRING='libpng 1.6.45'
PACKAGE_VERSION='1.6.46'
PACKAGE_STRING='libpng 1.6.46'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
PACKAGE_URL=''
@ -1421,7 +1421,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
'configure' configures libpng 1.6.45 to adapt to many kinds of systems.
'configure' configures libpng 1.6.46 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1492,7 +1492,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libpng 1.6.45:";;
short | recursive ) echo "Configuration of libpng 1.6.46:";;
esac
cat <<\_ACEOF
@ -1689,7 +1689,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libpng configure 1.6.45
libpng configure 1.6.46
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpng $as_me 1.6.45, which was
It was created by libpng $as_me 1.6.46, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@ -3433,7 +3433,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
VERSION='1.6.45'
VERSION='1.6.46'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -3528,10 +3528,10 @@ fi
PNGLIB_VERSION=1.6.45
PNGLIB_VERSION=1.6.46
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
PNGLIB_RELEASE=45
PNGLIB_RELEASE=46
@ -16165,7 +16165,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libpng $as_me 1.6.45, which was
This file was extended by libpng $as_me 1.6.46, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -16233,7 +16233,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
libpng config.status 1.6.45
libpng config.status 1.6.46
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"

@ -25,7 +25,7 @@ AC_PREREQ([2.68])
dnl Version number stuff here:
AC_INIT([libpng],[1.6.45],[png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng],[1.6.46],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts/autoconf])
# libpng does not follow GNU file name conventions (hence 'foreign')
@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.45
PNGLIB_VERSION=1.6.46
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
PNGLIB_RELEASE=45
PNGLIB_RELEASE=46
dnl End of version number stuff

@ -113,6 +113,8 @@ typedef png_byte *png_const_bytep;
#define png_PLTE PNG_U32( 80, 76, 84, 69)
#define png_bKGD PNG_U32( 98, 75, 71, 68)
#define png_cHRM PNG_U32( 99, 72, 82, 77)
#define png_cICP PNG_U32( 99, 73, 67, 80) /* PNGv3 */
#define png_cLLI PNG_U32( 99, 76, 76, 73) /* PNGv3 */
#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
#define png_gAMA PNG_U32(103, 65, 77, 65)
@ -122,6 +124,7 @@ typedef png_byte *png_const_bytep;
#define png_hIST PNG_U32(104, 73, 83, 84)
#define png_iCCP PNG_U32(105, 67, 67, 80)
#define png_iTXt PNG_U32(105, 84, 88, 116)
#define png_mDCV PNG_U32(109, 68, 67, 86) /* PNGv3 */
#define png_oFFs PNG_U32(111, 70, 70, 115)
#define png_pCAL PNG_U32(112, 67, 65, 76)
#define png_pHYs PNG_U32(112, 72, 89, 115)
@ -208,6 +211,20 @@ static struct
0,
# else
1,
# endif
1, START, 0 },
{ "cICP", PNG_INFO_cICP, png_cICP,
# ifdef PNG_READ_cICP_SUPPORTED
0,
# else
1,
# endif
1, START, 0 },
{ "cLLI", PNG_INFO_cLLI, png_cLLI,
# ifdef PNG_READ_cLLI_SUPPORTED
0,
# else
1,
# endif
1, START, 0 },
{ "eXIf", PNG_INFO_eXIf, png_eXIf,
@ -245,6 +262,13 @@ static struct
1,
# endif
1, ABSENT, 0 },
{ "mDCV", PNG_INFO_mDCV, png_mDCV,
# ifdef PNG_READ_mDCV_SUPPORTED
0,
# else
1,
# endif
1, START, 0 },
{ "oFFs", PNG_INFO_oFFs, png_oFFs,
# ifdef PNG_READ_oFFs_SUPPORTED
0,

@ -0,0 +1,29 @@
# https://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = unset
indent_size = unset
indent_style = space
insert_final_newline = true
max_doc_length = 79
max_line_length = 79
trim_trailing_whitespace = true
[*.[ch]]
indent_size = 2
indent_style = space
[CMakeLists.txt]
indent_size = 4
indent_style = space
max_doc_length = 79
max_line_length = 99
[{Makefile,makevms.com}]
indent_size = unset
indent_style = unset
max_doc_length = 79
max_line_length = 99

@ -11,3 +11,4 @@ version 1.0 - 1999.10.15 - First version.
1.6 - 2018.08.05 - Improve portability and fix style (Cosmin Truta)
1.7 - 2019.01.22 - Change license to MIT (Willem van Schaik)
1.8 - 2024.01.09 - Fix, improve, modernize (Cosmin Truta)
1.9 - 2025.01.10 - Delete conditionally-compiled code (Cosmin Truta)

@ -1,9 +1,9 @@
# Copyright (c) 2018-2024 Cosmin Truta
# Copyright (c) 2018-2025 Cosmin Truta
#
# This software is released under the MIT license. For conditions of
# distribution and use, see the LICENSE file part of this package.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.14)
project(PNGMINUS C)

@ -66,7 +66,7 @@ int main (int argc, char *argv[])
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
{
fname_al = argv[argi];
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: cannot create alpha-channel file %s\n",
argv[argi]);
exit (1);
@ -235,22 +235,6 @@ BOOL do_png2pnm (png_struct *png_ptr, png_info *info_ptr,
/* set up (if applicable) the expansion of grayscale images to bit-depth 8 */
png_set_expand_gray_1_2_4_to_8 (png_ptr);
#ifdef NJET
/* downgrade 16-bit images to 8-bit */
if (bit_depth == 16)
png_set_strip_16 (png_ptr);
/* transform grayscale images into full-color */
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb (png_ptr);
/* if the PNG image has a gAMA chunk then gamma-correct the output image */
{
double file_gamma;
if (png_get_gAMA (png_ptr, info_ptr, &file_gamma))
png_set_gamma (png_ptr, (double) 2.2, file_gamma);
}
#endif
/* read the image file, with all of the above image transforms applied */
png_read_png (png_ptr, info_ptr, 0, NULL);

@ -9,7 +9,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng version 1.6.36, December 2018, through 1.6.45 - January 2025
libpng version 1.6.36, December 2018, through 1.6.46 - January 2025
Updated and distributed by Cosmin Truta
Copyright (c) 2018-2025 Cosmin Truta

@ -1,6 +1,6 @@
.TH LIBPNG 3 "January 7, 2025"
.TH LIBPNG 3 "January 23, 2025"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.45
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.46
.SH SYNOPSIS
\fB#include <png.h>\fP
@ -528,7 +528,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng version 1.6.36, December 2018, through 1.6.45 - January 2025
libpng version 1.6.36, December 2018, through 1.6.46 - January 2025
Updated and distributed by Cosmin Truta
Copyright (c) 2018-2025 Cosmin Truta

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "January 7, 2025"
.TH LIBPNGPF 3 "January 23, 2025"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.45
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.46
(private functions)
.SH SYNOPSIS

@ -1,4 +1,4 @@
.TH PNG 5 "January 7, 2025"
.TH PNG 5 "January 23, 2025"
.SH NAME
png \- Portable Network Graphics (PNG) format

@ -13,7 +13,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_45 Your_png_h_is_not_version_1_6_45;
typedef png_libpng_version_1_6_46 Your_png_h_is_not_version_1_6_46;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@ -793,7 +793,7 @@ png_get_copyright(png_const_structrp png_ptr)
return PNG_STRING_COPYRIGHT
#else
return PNG_STRING_NEWLINE \
"libpng version 1.6.45" PNG_STRING_NEWLINE \
"libpng version 1.6.46" PNG_STRING_NEWLINE \
"Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
@ -1544,56 +1544,59 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
* Adobe Wide Gamut RGB
* 0.258728243040113 0.724682314948566 0.016589442011321
*/
int error = 0;
/* By the argument above overflow should be impossible here, however the
* code now simply returns a failure code. The xy subtracts in the arguments
* to png_muldiv are *not* checked for overflow because the checks at the
* start guarantee they are in the range 0..110000 and png_fixed_point is a
* 32-bit signed number.
*/
if (png_muldiv(&left, xy->greenx-xy->bluex, xy->redy - xy->bluey, 8) == 0)
return 1;
if (png_muldiv(&right, xy->greeny-xy->bluey, xy->redx - xy->bluex, 8) == 0)
return 1;
denominator = png_fp_sub(left, right, &error);
if (error) return 1;
{
int error = 0;
/* Now find the red numerator. */
if (png_muldiv(&left, xy->greenx-xy->bluex, xy->whitey-xy->bluey, 8) == 0)
return 1;
if (png_muldiv(&right, xy->greeny-xy->bluey, xy->whitex-xy->bluex, 8) == 0)
return 1;
/* By the argument above overflow should be impossible here, however the
* code now simply returns a failure code. The xy subtracts in the
* arguments to png_muldiv are *not* checked for overflow because the
* checks at the start guarantee they are in the range 0..110000 and
* png_fixed_point is a 32-bit signed number.
*/
if (png_muldiv(&left, xy->greenx-xy->bluex, xy->redy - xy->bluey, 8) == 0)
return 1;
if (png_muldiv(&right, xy->greeny-xy->bluey, xy->redx - xy->bluex, 8) ==
0)
return 1;
denominator = png_fp_sub(left, right, &error);
if (error) return 1;
/* Overflow is possible here and it indicates an extreme set of PNG cHRM
* chunk values. This calculation actually returns the reciprocal of the
* scale value because this allows us to delay the multiplication of white-y
* into the denominator, which tends to produce a small number.
*/
if (png_muldiv(&red_inverse, xy->whitey, denominator,
png_fp_sub(left, right, &error)) == 0 || error ||
red_inverse <= xy->whitey /* r+g+b scales = white scale */)
return 1;
/* Now find the red numerator. */
if (png_muldiv(&left, xy->greenx-xy->bluex, xy->whitey-xy->bluey, 8) == 0)
return 1;
if (png_muldiv(&right, xy->greeny-xy->bluey, xy->whitex-xy->bluex, 8) ==
0)
return 1;
/* Similarly for green_inverse: */
if (png_muldiv(&left, xy->redy-xy->bluey, xy->whitex-xy->bluex, 8) == 0)
return 1;
if (png_muldiv(&right, xy->redx-xy->bluex, xy->whitey-xy->bluey, 8) == 0)
return 1;
if (png_muldiv(&green_inverse, xy->whitey, denominator,
png_fp_sub(left, right, &error)) == 0 || error ||
green_inverse <= xy->whitey)
return 1;
/* Overflow is possible here and it indicates an extreme set of PNG cHRM
* chunk values. This calculation actually returns the reciprocal of the
* scale value because this allows us to delay the multiplication of
* white-y into the denominator, which tends to produce a small number.
*/
if (png_muldiv(&red_inverse, xy->whitey, denominator,
png_fp_sub(left, right, &error)) == 0 || error ||
red_inverse <= xy->whitey /* r+g+b scales = white scale */)
return 1;
/* And the blue scale, the checks above guarantee this can't overflow but it
* can still produce 0 for extreme cHRM values.
*/
blue_scale = png_fp_sub(png_fp_sub(png_reciprocal(xy->whitey),
png_reciprocal(red_inverse), &error),
png_reciprocal(green_inverse), &error);
if (error || blue_scale <= 0)
return 1;
/* Similarly for green_inverse: */
if (png_muldiv(&left, xy->redy-xy->bluey, xy->whitex-xy->bluex, 8) == 0)
return 1;
if (png_muldiv(&right, xy->redx-xy->bluex, xy->whitey-xy->bluey, 8) == 0)
return 1;
if (png_muldiv(&green_inverse, xy->whitey, denominator,
png_fp_sub(left, right, &error)) == 0 || error ||
green_inverse <= xy->whitey)
return 1;
/* And the blue scale, the checks above guarantee this can't overflow but
* it can still produce 0 for extreme cHRM values.
*/
blue_scale = png_fp_sub(png_fp_sub(png_reciprocal(xy->whitey),
png_reciprocal(red_inverse), &error),
png_reciprocal(green_inverse), &error);
if (error || blue_scale <= 0)
return 1;
}
/* And fill in the png_XYZ. Again the subtracts are safe because of the
* checks on the xy values at the start (the subtracts just calculate the
@ -3390,6 +3393,26 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
}
#endif
#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
!defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
(defined(PNG_cLLI_SUPPORTED) || defined(PNG_mDCV_SUPPORTED))
png_uint_32
png_fixed_ITU(png_const_structrp png_ptr, double fp, png_const_charp text)
{
double r = floor(10000 * fp + .5);
if (r > 2147483647. || r < 0)
png_fixed_error(png_ptr, text);
# ifndef PNG_ERROR_TEXT_SUPPORTED
PNG_UNUSED(text)
# endif
return (png_uint_32)r;
}
#endif
#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_COLORSPACE_SUPPORTED) ||\
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
/* muldiv functions */

@ -1,6 +1,6 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.6.45
* libpng version 1.6.46
*
* Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
@ -14,7 +14,7 @@
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
* Glenn Randers-Pehrson
* libpng versions 1.6.36, December 2018, through 1.6.45, January 2025:
* libpng versions 1.6.36, December 2018, through 1.6.46, January 2025:
* Cosmin Truta
* See also "Contributing Authors", below.
*/
@ -238,7 +238,7 @@
* ...
* 1.5.30 15 10530 15.so.15.30[.0]
* ...
* 1.6.45 16 10645 16.so.16.45[.0]
* 1.6.46 16 10646 16.so.16.46[.0]
*
* Henceforth the source version will match the shared-library major and
* minor numbers; the shared-library major version number will be used for
@ -274,7 +274,7 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.45"
#define PNG_LIBPNG_VER_STRING "1.6.46"
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
/* The versions of shared library builds should stay in sync, going forward */
@ -285,7 +285,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 45
#define PNG_LIBPNG_VER_RELEASE 46
/* This should be zero for a public release, or non-zero for a
* development version.
@ -316,7 +316,7 @@
* From version 1.0.1 it is:
* XXYYZZ, where XX=major, YY=minor, ZZ=release
*/
#define PNG_LIBPNG_VER 10645 /* 1.6.45 */
#define PNG_LIBPNG_VER 10646 /* 1.6.46 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@ -426,7 +426,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef char* png_libpng_version_1_6_45;
typedef char* png_libpng_version_1_6_46;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@ -744,7 +744,21 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
#define PNG_INFO_cICP 0x20000U
#define PNG_INFO_cICP 0x20000U /* PNGv3: 1.6.45 */
#define PNG_INFO_cLLI 0x40000U /* PNGv3: 1.6.45 */
#define PNG_INFO_mDCV 0x80000U /* PNGv3: 1.6.45 */
/* APNG: these chunks are stored as unknown, these flags are never set
* however they are provided as a convenience for implementors of APNG and
* avoids any merge conflicts.
*
* Private chunks: these chunk names violate the chunk name recommendations
* because the chunk definitions have no signature and because the private
* chunks with these names have been reserved. Private definitions should
* avoid them.
*/
#define PNG_INFO_acTL 0x100000U /* PNGv3: 1.6.45: unknown */
#define PNG_INFO_fcTL 0x200000U /* PNGv3: 1.6.45: unknown */
#define PNG_INFO_fdAT 0x400000U /* PNGv3: 1.6.45: unknown */
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@ -1976,15 +1990,44 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
#ifdef PNG_cICP_SUPPORTED
PNG_EXPORT(250, png_uint_32, png_get_cICP, (png_const_structrp png_ptr,
png_inforp info_ptr, png_bytep colour_primaries,
png_const_inforp info_ptr, png_bytep colour_primaries,
png_bytep transfer_function, png_bytep matrix_coefficients,
png_bytep video_full_range_flag));
#endif
#ifdef PNG_cICP_SUPPORTED
PNG_EXPORT(251, void, png_set_cICP, (png_const_structrp png_ptr,
png_inforp info_ptr, png_byte colour_primaries,
png_byte transfer_function, png_byte matrix_coefficients,
png_byte video_full_range_flag));
#endif
#ifdef PNG_cLLI_SUPPORTED
PNG_FP_EXPORT(252, png_uint_32, png_get_cLLI, (png_const_structrp png_ptr,
png_const_inforp info_ptr, double *maximum_content_light_level,
double *maximum_frame_average_light_level))
PNG_FIXED_EXPORT(253, png_uint_32, png_get_cLLI_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr,
/* The values below are in cd/m2 (nits) and are scaled by 10,000; not
* 100,000 as in the case of png_fixed_point.
*/
png_uint_32p maximum_content_light_level_scaled_by_10000,
png_uint_32p maximum_frame_average_light_level_scaled_by_10000))
#endif
#ifdef PNG_cLLI_SUPPORTED
PNG_FP_EXPORT(254, void, png_set_cLLI, (png_const_structrp png_ptr,
png_inforp info_ptr, double maximum_content_light_level,
double maximum_frame_average_light_level))
PNG_FIXED_EXPORT(255, void, png_set_cLLI_fixed, (png_const_structrp png_ptr,
png_inforp info_ptr,
/* The values below are in cd/m2 (nits) and are scaled by 10,000; not
* 100,000 as in the case of png_fixed_point.
*/
png_uint_32 maximum_content_light_level_scaled_by_10000,
png_uint_32 maximum_frame_average_light_level_scaled_by_10000))
#endif
#ifdef PNG_eXIf_SUPPORTED
PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
png_inforp info_ptr, png_bytep *exif));
@ -2029,6 +2072,60 @@ PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr,
int color_type, int interlace_method, int compression_method,
int filter_method));
#ifdef PNG_mDCV_SUPPORTED
PNG_FP_EXPORT(256, png_uint_32, png_get_mDCV, (png_const_structrp png_ptr,
png_const_inforp info_ptr,
/* The chromaticities of the mastering display. As cHRM, but independent of
* the encoding endpoints in cHRM, or cICP, or iCCP. These values will
* always be in the range 0 to 1.3107.
*/
double *white_x, double *white_y, double *red_x, double *red_y,
double *green_x, double *green_y, double *blue_x, double *blue_y,
/* Mastering display luminance in cd/m2 (nits). */
double *mastering_display_maximum_luminance,
double *mastering_display_minimum_luminance))
PNG_FIXED_EXPORT(257, png_uint_32, png_get_mDCV_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_fixed_point *int_white_x, png_fixed_point *int_white_y,
png_fixed_point *int_red_x, png_fixed_point *int_red_y,
png_fixed_point *int_green_x, png_fixed_point *int_green_y,
png_fixed_point *int_blue_x, png_fixed_point *int_blue_y,
/* Mastering display luminance in cd/m2 (nits) multiplied (scaled) by
* 10,000.
*/
png_uint_32p mastering_display_maximum_luminance_scaled_by_10000,
png_uint_32p mastering_display_minimum_luminance_scaled_by_10000))
#endif
#ifdef PNG_mDCV_SUPPORTED
PNG_FP_EXPORT(258, void, png_set_mDCV, (png_const_structrp png_ptr,
png_inforp info_ptr,
/* The chromaticities of the mastering display. As cHRM, but independent of
* the encoding endpoints in cHRM, or cICP, or iCCP.
*/
double white_x, double white_y, double red_x, double red_y, double green_x,
double green_y, double blue_x, double blue_y,
/* Mastering display luminance in cd/m2 (nits). */
double mastering_display_maximum_luminance,
double mastering_display_minimum_luminance))
PNG_FIXED_EXPORT(259, void, png_set_mDCV_fixed, (png_const_structrp png_ptr,
png_inforp info_ptr,
/* The admissible range of these values is not the full range of a PNG
* fixed point value. Negative values cannot be encoded and the maximum
* value is about 1.3 */
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y,
png_fixed_point int_green_x, png_fixed_point int_green_y,
png_fixed_point int_blue_x, png_fixed_point int_blue_y,
/* These are PNG unsigned 4 byte values: 31-bit unsigned values. The MSB
* must be zero.
*/
png_uint_32 mastering_display_maximum_luminance_scaled_by_10000,
png_uint_32 mastering_display_minimum_luminance_scaled_by_10000))
#endif
#ifdef PNG_oFFs_SUPPORTED
PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr,
png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
@ -3249,7 +3346,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
* one to use is one more than this.)
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
PNG_EXPORT_LAST_ORDINAL(251);
PNG_EXPORT_LAST_ORDINAL(259);
#endif
#ifdef __cplusplus

@ -1,6 +1,6 @@
/* pngconf.h - machine-configurable file for libpng
*
* libpng version 1.6.45
* libpng version 1.6.46
*
* Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson

@ -787,7 +787,7 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
#ifdef PNG_cICP_SUPPORTED
png_uint_32 PNGAPI
png_get_cICP(png_const_structrp png_ptr,
png_inforp info_ptr, png_bytep colour_primaries,
png_const_inforp info_ptr, png_bytep colour_primaries,
png_bytep transfer_function, png_bytep matrix_coefficients,
png_bytep video_full_range_flag)
{
@ -805,10 +805,115 @@ png_get_cICP(png_const_structrp png_ptr,
return (PNG_INFO_cICP);
}
return (0);
return 0;
}
#endif
#ifdef PNG_cLLI_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_cLLI_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_32p maxCLL,
png_uint_32p maxFALL)
{
png_debug1(1, "in %s retrieval function", "cLLI");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_cLLI) != 0)
{
if (maxCLL != NULL) *maxCLL = info_ptr->maxCLL;
if (maxFALL != NULL) *maxFALL = info_ptr->maxFALL;
return PNG_INFO_cLLI;
}
return 0;
}
# endif
# ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_cLLI(png_const_structrp png_ptr, png_const_inforp info_ptr,
double *maxCLL, double *maxFALL)
{
png_debug1(1, "in %s retrieval function", "cLLI(float)");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_cLLI) != 0)
{
if (maxCLL != NULL) *maxCLL = info_ptr->maxCLL * .0001;
if (maxFALL != NULL) *maxFALL = info_ptr->maxFALL * .0001;
return PNG_INFO_cLLI;
}
return 0;
}
# endif
#endif /* cLLI */
#ifdef PNG_mDCV_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_mDCV_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_fixed_point *white_x, png_fixed_point *white_y,
png_fixed_point *red_x, png_fixed_point *red_y,
png_fixed_point *green_x, png_fixed_point *green_y,
png_fixed_point *blue_x, png_fixed_point *blue_y,
png_uint_32p mastering_maxDL, png_uint_32p mastering_minDL)
{
png_debug1(1, "in %s retrieval function", "mDCV");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_mDCV) != 0)
{
if (white_x != NULL) *white_x = info_ptr->mastering_white_x * 2;
if (white_y != NULL) *white_y = info_ptr->mastering_white_y * 2;
if (red_x != NULL) *red_x = info_ptr->mastering_red_x * 2;
if (red_y != NULL) *red_y = info_ptr->mastering_red_y * 2;
if (green_x != NULL) *green_x = info_ptr->mastering_green_x * 2;
if (green_y != NULL) *green_y = info_ptr->mastering_green_y * 2;
if (blue_x != NULL) *blue_x = info_ptr->mastering_blue_x * 2;
if (blue_y != NULL) *blue_y = info_ptr->mastering_blue_y * 2;
if (mastering_maxDL != NULL) *mastering_maxDL = info_ptr->mastering_maxDL;
if (mastering_minDL != NULL) *mastering_minDL = info_ptr->mastering_minDL;
return PNG_INFO_mDCV;
}
return 0;
}
# endif
# ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_mDCV(png_const_structrp png_ptr, png_const_inforp info_ptr,
double *white_x, double *white_y, double *red_x, double *red_y,
double *green_x, double *green_y, double *blue_x, double *blue_y,
double *mastering_maxDL, double *mastering_minDL)
{
png_debug1(1, "in %s retrieval function", "mDCV(float)");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_mDCV) != 0)
{
if (white_x != NULL) *white_x = info_ptr->mastering_white_x * .00002;
if (white_y != NULL) *white_y = info_ptr->mastering_white_y * .00002;
if (red_x != NULL) *red_x = info_ptr->mastering_red_x * .00002;
if (red_y != NULL) *red_y = info_ptr->mastering_red_y * .00002;
if (green_x != NULL) *green_x = info_ptr->mastering_green_x * .00002;
if (green_y != NULL) *green_y = info_ptr->mastering_green_y * .00002;
if (blue_x != NULL) *blue_x = info_ptr->mastering_blue_x * .00002;
if (blue_y != NULL) *blue_y = info_ptr->mastering_blue_y * .00002;
if (mastering_maxDL != NULL)
*mastering_maxDL = info_ptr->mastering_maxDL * .0001;
if (mastering_minDL != NULL)
*mastering_minDL = info_ptr->mastering_minDL * .0001;
return PNG_INFO_mDCV;
}
return 0;
}
# endif /* FLOATING_POINT */
#endif /* mDCV */
#ifdef PNG_eXIf_SUPPORTED
png_uint_32 PNGAPI
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,

@ -115,6 +115,24 @@ struct png_info_def
png_uint_32 iccp_proflen; /* ICC profile data length */
#endif
#ifdef PNG_cLLI_SUPPORTED
png_uint_32 maxCLL; /* cd/m2 (nits) * 10,000 */
png_uint_32 maxFALL;
#endif
#ifdef PNG_mDCV_SUPPORTED
png_uint_16 mastering_red_x; /* CIE (xy) x * 50,000 */
png_uint_16 mastering_red_y;
png_uint_16 mastering_green_x;
png_uint_16 mastering_green_y;
png_uint_16 mastering_blue_x;
png_uint_16 mastering_blue_y;
png_uint_16 mastering_white_x;
png_uint_16 mastering_white_y;
png_uint_32 mastering_maxDL; /* cd/m2 (nits) * 10,000 */
png_uint_32 mastering_minDL;
#endif
#ifdef PNG_TEXT_SUPPORTED
/* The tEXt, and zTXt chunks contain human-readable textual data in
* uncompressed, compressed, and optionally compressed forms, respectively.

@ -316,6 +316,22 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
png_handle_cICP(png_ptr, info_ptr, png_ptr->push_length);
}
#endif
#ifdef PNG_READ_cLLI_SUPPORTED
else if (png_ptr->chunk_name == png_cLLI)
{
PNG_PUSH_SAVE_BUFFER_IF_FULL
png_handle_cLLI(png_ptr, info_ptr, png_ptr->push_length);
}
#endif
#ifdef PNG_READ_mDCV_SUPPORTED
else if (png_ptr->chunk_name == png_mDCV)
{
PNG_PUSH_SAVE_BUFFER_IF_FULL
png_handle_mDCV(png_ptr, info_ptr, png_ptr->push_length);
}
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
else if (png_ptr->chunk_name == png_eXIf)

@ -782,6 +782,8 @@
#ifdef PNG_FIXED_POINT_MACRO_SUPPORTED
#define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
#define png_fixed_ITU(png_ptr, fp, s) ((fp) <= 214748 && (fp) >= 0 ?\
((png_uint_32)(10000 * (fp))) : (png_fixed_error(png_ptr, s),0))
#endif
/* else the corresponding function is defined below, inside the scope of the
* cplusplus test.
@ -834,7 +836,8 @@
#define png_PLTE PNG_U32( 80, 76, 84, 69)
#define png_bKGD PNG_U32( 98, 75, 71, 68)
#define png_cHRM PNG_U32( 99, 72, 82, 77)
#define png_cICP PNG_U32( 99, 73, 67, 80)
#define png_cICP PNG_U32( 99, 73, 67, 80) /* PNGv3 */
#define png_cLLI PNG_U32( 99, 76, 76, 73) /* PNGv3 */
#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
#define png_gAMA PNG_U32(103, 65, 77, 65)
@ -844,6 +847,7 @@
#define png_hIST PNG_U32(104, 73, 83, 84)
#define png_iCCP PNG_U32(105, 67, 67, 80)
#define png_iTXt PNG_U32(105, 84, 88, 116)
#define png_mDCV PNG_U32(109, 68, 67, 86) /* PNGv3 */
#define png_oFFs PNG_U32(111, 70, 70, 115)
#define png_pCAL PNG_U32(112, 67, 65, 76)
#define png_pHYs PNG_U32(112, 72, 89, 115)
@ -971,6 +975,7 @@ PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr,
!defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
(defined(PNG_gAMA_SUPPORTED) || defined(PNG_cHRM_SUPPORTED) || \
defined(PNG_sCAL_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_mDCV_SUPPORTED) || \
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)) || \
(defined(PNG_sCAL_SUPPORTED) && \
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED))
@ -978,6 +983,13 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_fixed,(png_const_structrp png_ptr,
double fp, png_const_charp text),PNG_EMPTY);
#endif
#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
!defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
(defined(PNG_cLLI_SUPPORTED) || defined(PNG_mDCV_SUPPORTED))
PNG_INTERNAL_FUNCTION(png_uint_32,png_fixed_ITU,(png_const_structrp png_ptr,
double fp, png_const_charp text),PNG_EMPTY);
#endif
/* Check the user version string for compatibility, returns false if the version
* numbers aren't compatible.
*/
@ -1137,6 +1149,20 @@ PNG_INTERNAL_FUNCTION(void,png_write_cICP,(png_structrp png_ptr,
png_byte matrix_coefficients, png_byte video_full_range_flag), PNG_EMPTY);
#endif
#ifdef PNG_WRITE_cLLI_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_cLLI_fixed,(png_structrp png_ptr,
png_uint_32 maxCLL, png_uint_32 maxFALL), PNG_EMPTY);
#endif
#ifdef PNG_WRITE_mDCV_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_mDCV_fixed,(png_structrp png_ptr,
png_uint_16 red_x, png_uint_16 red_y,
png_uint_16 green_x, png_uint_16 green_y,
png_uint_16 blue_x, png_uint_16 blue_y,
png_uint_16 white_x, png_uint_16 white_y,
png_uint_32 maxDL, png_uint_32 minDL), PNG_EMPTY);
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
int intent),PNG_EMPTY);
@ -1485,6 +1511,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cICP,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif
#ifdef PNG_READ_cLLI_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_cLLI,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
@ -1510,6 +1541,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif
#ifdef PNG_READ_mDCV_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_mDCV,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif
#ifdef PNG_READ_oFFs_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_oFFs,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);

@ -179,6 +179,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
png_handle_cICP(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_cLLI_SUPPORTED
else if (chunk_name == png_cLLI)
png_handle_cLLI(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
else if (chunk_name == png_eXIf)
png_handle_eXIf(png_ptr, info_ptr, length);
@ -194,6 +199,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
png_handle_hIST(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_mDCV_SUPPORTED
else if (chunk_name == png_mDCV)
png_handle_mDCV(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_oFFs_SUPPORTED
else if (chunk_name == png_oFFs)
png_handle_oFFs(png_ptr, info_ptr, length);
@ -861,6 +871,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
png_handle_cICP(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_cLLI_SUPPORTED
else if (chunk_name == png_cLLI)
png_handle_cLLI(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
else if (chunk_name == png_eXIf)
png_handle_eXIf(png_ptr, info_ptr, length);
@ -876,6 +891,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
png_handle_hIST(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_mDCV_SUPPORTED
else if (chunk_name == png_mDCV)
png_handle_mDCV(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_oFFs_SUPPORTED
else if (chunk_name == png_oFFs)
png_handle_oFFs(png_ptr, info_ptr, length);

@ -2087,6 +2087,111 @@ png_handle_cICP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
}
#endif
#ifdef PNG_READ_cLLI_SUPPORTED
void /* PRIVATE */
png_handle_cLLI(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_byte buf[8];
png_debug(1, "in png_handle_cLLI");
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");
else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "out of place");
return;
}
else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cLLI) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "duplicate");
return;
}
else if (length != 8)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "invalid");
return;
}
png_crc_read(png_ptr, buf, 8);
if (png_crc_finish(png_ptr, 0) != 0)
return;
/* The error checking happens here, this puts it in just one place: */
png_set_cLLI_fixed(png_ptr, info_ptr, png_get_uint_32(buf),
png_get_uint_32(buf+4));
}
#endif
#ifdef PNG_READ_mDCV_SUPPORTED
void /* PRIVATE */
png_handle_mDCV(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_byte buf[24];
png_debug(1, "in png_handle_mDCV");
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");
else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "out of place");
return;
}
else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_mDCV) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "duplicate");
return;
}
else if (length != 24)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "invalid");
return;
}
png_crc_read(png_ptr, buf, 24);
if (png_crc_finish(png_ptr, 0) != 0)
return;
/* The error checking happens here, this puts it in just one place. The
* odd /50000 scaling factor makes it more difficult but the (x.y) values are
* only two bytes so a <<1 is safe.
*
* WARNING: the PNG specification defines the cHRM chunk to **start** with
* the white point (x,y). The W3C PNG v3 specification puts the white point
* **after* R,G,B. The x,y values in mDCV are also scaled by 50,000 and
* stored in just two bytes, whereas those in cHRM are scaled by 100,000 and
* stored in four bytes. This is very, very confusing. These APIs remove
* the confusion by copying the existing, well established, API.
*/
png_set_mDCV_fixed(png_ptr, info_ptr,
png_get_uint_16(buf+12U) << 1U, /* white x */
png_get_uint_16(buf+14U) << 1U, /* white y */
png_get_uint_16(buf+ 0U) << 1U, /* red x */
png_get_uint_16(buf+ 2U) << 1U, /* red y */
png_get_uint_16(buf+ 4U) << 1U, /* green x */
png_get_uint_16(buf+ 6U) << 1U, /* green y */
png_get_uint_16(buf+ 8U) << 1U, /* blue x */
png_get_uint_16(buf+10U) << 1U, /* blue y */
png_get_uint_32(buf+16U), /* peak luminance */
png_get_uint_32(buf+20U));/* minimum perceivable luminance */
}
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
void /* PRIVATE */
png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)

@ -159,6 +159,158 @@ png_set_cICP(png_const_structrp png_ptr, png_inforp info_ptr,
}
#endif /* cICP */
#ifdef PNG_cLLI_SUPPORTED
void PNGFAPI
png_set_cLLI_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
/* The values below are in cd/m2 (nits) and are scaled by 10,000; not
* 100,000 as in the case of png_fixed_point.
*/
png_uint_32 maxCLL, png_uint_32 maxFALL)
{
png_debug1(1, "in %s storage function", "cLLI");
if (png_ptr == NULL || info_ptr == NULL)
return;
/* Check the light level range: */
if (maxCLL > 0x7FFFFFFFU || maxFALL > 0x7FFFFFFFU)
{
/* The limit is 200kcd/m2; somewhat bright but not inconceivable because
* human vision is said to run up to 100Mcd/m2. The sun is about 2Gcd/m2.
*
* The reference sRGB monitor is 80cd/m2 and the limit of PQ encoding is
* 2kcd/m2.
*/
png_chunk_report(png_ptr, "cLLI light level exceeds PNG limit",
PNG_CHUNK_WRITE_ERROR);
return;
}
info_ptr->maxCLL = maxCLL;
info_ptr->maxFALL = maxFALL;
info_ptr->valid |= PNG_INFO_cLLI;
}
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_cLLI(png_const_structrp png_ptr, png_inforp info_ptr,
double maxCLL, double maxFALL)
{
png_set_cLLI_fixed(png_ptr, info_ptr,
png_fixed_ITU(png_ptr, maxCLL, "png_set_cLLI(maxCLL)"),
png_fixed_ITU(png_ptr, maxFALL, "png_set_cLLI(maxFALL)"));
}
# endif /* FLOATING_POINT */
#endif /* cLLI */
#ifdef PNG_mDCV_SUPPORTED
static png_uint_16
png_ITU_fixed_16(png_const_structrp png_ptr, png_fixed_point v,
png_const_charp text)
{
/* Return a safe uint16_t value scaled according to the ITU H273 rules for
* 16-bit display chromaticities. Functions like the corresponding
* png_fixed() internal function with regard to errors: it's an error on
* write, a chunk_benign_error on read: See the definition of
* png_chunk_report in pngpriv.h.
*/
v /= 2; /* rounds to 0 in C: avoids insignificant arithmetic errors */
if (v > 65535 || v < 0)
png_fixed_error(png_ptr, text);
# ifndef PNG_ERROR_TEXT_SUPPORTED
PNG_UNUSED(text)
# endif
return (png_uint_16)/*SAFE*/v;
}
void PNGAPI
png_set_mDCV_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
png_fixed_point white_x, png_fixed_point white_y,
png_fixed_point red_x, png_fixed_point red_y,
png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y,
png_uint_32 maxDL,
png_uint_32 minDL)
{
png_uint_16 rx, ry, gx, gy, bx, by, wx, wy;
png_debug1(1, "in %s storage function", "mDCV");
if (png_ptr == NULL || info_ptr == NULL)
return;
/* Check the input values to ensure they are in the expected range: */
rx = png_ITU_fixed_16(png_ptr, red_x, "png_set_mDCV(red(x))");
ry = png_ITU_fixed_16(png_ptr, red_y, "png_set_mDCV(red(y))");
gx = png_ITU_fixed_16(png_ptr, green_x, "png_set_mDCV(green(x))");
gy = png_ITU_fixed_16(png_ptr, green_y, "png_set_mDCV(green(y))");
bx = png_ITU_fixed_16(png_ptr, blue_x, "png_set_mDCV(blue(x))");
by = png_ITU_fixed_16(png_ptr, blue_y, "png_set_mDCV(blue(y))");
wx = png_ITU_fixed_16(png_ptr, white_x, "png_set_mDCV(white(x))");
wy = png_ITU_fixed_16(png_ptr, white_y, "png_set_mDCV(white(y))");
/* Check the light level range: */
if (maxDL > 0x7FFFFFFFU || minDL > 0x7FFFFFFFU)
{
/* The limit is 200kcd/m2; somewhat bright but not inconceivable because
* human vision is said to run up to 100Mcd/m2. The sun is about 2Gcd/m2.
*
* The reference sRGB monitor is 80cd/m2 and the limit of PQ encoding is
* 2kcd/m2.
*/
png_chunk_report(png_ptr, "mDCV display light level exceeds PNG limit",
PNG_CHUNK_WRITE_ERROR);
return;
}
/* All values are safe, the settings are accepted.
*
* IMPLEMENTATION NOTE: in practice the values can be checked and assigned
* but the result is confusing if a writing app calls png_set_mDCV more than
* once, the second time with an invalid value. This approach is more
* obviously correct at the cost of typing and a very slight machine
* overhead.
*/
info_ptr->mastering_red_x = rx;
info_ptr->mastering_red_y = ry;
info_ptr->mastering_green_x = gx;
info_ptr->mastering_green_y = gy;
info_ptr->mastering_blue_x = bx;
info_ptr->mastering_blue_y = by;
info_ptr->mastering_white_x = wx;
info_ptr->mastering_white_y = wy;
info_ptr->mastering_maxDL = maxDL;
info_ptr->mastering_minDL = minDL;
info_ptr->valid |= PNG_INFO_mDCV;
}
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_mDCV(png_const_structrp png_ptr, png_inforp info_ptr,
double white_x, double white_y, double red_x, double red_y, double green_x,
double green_y, double blue_x, double blue_y,
double maxDL, double minDL)
{
png_set_mDCV_fixed(png_ptr, info_ptr,
/* The ITU approach is to scale by 50,000, not 100,000 so just divide
* the input values by 2 and use png_fixed:
*/
png_fixed(png_ptr, white_x / 2, "png_set_mDCV(white(x))"),
png_fixed(png_ptr, white_y / 2, "png_set_mDCV(white(y))"),
png_fixed(png_ptr, red_x / 2, "png_set_mDCV(red(x))"),
png_fixed(png_ptr, red_y / 2, "png_set_mDCV(red(y))"),
png_fixed(png_ptr, green_x / 2, "png_set_mDCV(green(x))"),
png_fixed(png_ptr, green_y / 2, "png_set_mDCV(green(y))"),
png_fixed(png_ptr, blue_x / 2, "png_set_mDCV(blue(x))"),
png_fixed(png_ptr, blue_y / 2, "png_set_mDCV(blue(y))"),
png_fixed_ITU(png_ptr, maxDL, "png_set_mDCV(maxDL)"),
png_fixed_ITU(png_ptr, minDL, "png_set_mDCV(minDL)"));
}
# endif /* FLOATING_POINT */
#endif /* mDCV */
#ifdef PNG_eXIf_SUPPORTED
void PNGAPI
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
@ -1421,11 +1573,13 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
98, 75, 71, 68, '\0', /* bKGD */
99, 72, 82, 77, '\0', /* cHRM */
99, 73, 67, 80, '\0', /* cICP */
99, 76, 76, 73, '\0', /* cLLI */
101, 88, 73, 102, '\0', /* eXIf */
103, 65, 77, 65, '\0', /* gAMA */
104, 73, 83, 84, '\0', /* hIST */
105, 67, 67, 80, '\0', /* iCCP */
105, 84, 88, 116, '\0', /* iTXt */
109, 68, 67, 86, '\0', /* mDCV */
111, 70, 70, 115, '\0', /* oFFs */
112, 67, 65, 76, '\0', /* pCAL */
112, 72, 89, 115, '\0', /* pHYs */

@ -50,7 +50,7 @@
#define STDERR stdout
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_45 Your_png_h_is_not_version_1_6_45;
typedef png_libpng_version_1_6_46 Your_png_h_is_not_version_1_6_46;
/* Ensure that all version numbers in png.h are consistent with one another. */
#if (PNG_LIBPNG_VER != PNG_LIBPNG_VER_MAJOR * 10000 + \
@ -1142,6 +1142,30 @@ test_one_file(const char *inname, const char *outname)
png_set_gAMA_fixed(write_ptr, write_info_ptr, gamma);
}
#endif
#ifdef PNG_cLLI_SUPPORTED
{
png_uint_32 maxCLL;
png_uint_32 maxFALL;
if (png_get_cLLI_fixed(read_ptr, read_info_ptr, &maxCLL, &maxFALL) != 0)
png_set_cLLI_fixed(write_ptr, write_info_ptr, maxCLL, maxFALL);
}
#endif
#ifdef PNG_mDCV_SUPPORTED
{
png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y;
png_uint_32 maxDL;
png_uint_32 minDL;
if (png_get_mDCV_fixed(read_ptr, read_info_ptr, &white_x, &white_y,
&red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y,
&maxDL, &minDL) != 0)
png_set_mDCV_fixed(write_ptr, write_info_ptr, white_x, white_y,
red_x, red_y, green_x, green_y, blue_x, blue_y,
maxDL, minDL);
}
#endif
#else /* Use floating point versions */
#ifdef PNG_FLOATING_POINT_SUPPORTED
#ifdef PNG_cHRM_SUPPORTED
@ -1165,6 +1189,29 @@ test_one_file(const char *inname, const char *outname)
png_set_gAMA(write_ptr, write_info_ptr, gamma);
}
#endif
#ifdef PNG_cLLI_SUPPORTED
{
double maxCLL;
double maxFALL;
if (png_get_cLLI(read_ptr, read_info_ptr, &maxCLL, &maxFALL) != 0)
png_set_cLLI(write_ptr, write_info_ptr, maxCLL, maxFALL);
}
#endif
#ifdef PNG_mDCV_SUPPORTED
{
double white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
double maxDL;
double minDL;
if (png_get_mDCV(read_ptr, read_info_ptr, &white_x, &white_y,
&red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y,
&maxDL, &minDL) != 0)
png_set_mDCV(write_ptr, write_info_ptr, white_x, white_y,
red_x, red_y, green_x, green_y, blue_x, blue_y,
maxDL, minDL);
}
#endif
#endif /* Floating point */
#endif /* Fixed point */
#ifdef PNG_cICP_SUPPORTED

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

@ -157,7 +157,30 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
* space priority. As above it therefore behooves libpng to write the colour
* space chunks in the priority order so that a streaming app need not buffer
* them.
*
* PNG v3: Chunks mDCV and cLLI provide ancillary information for the
* interpretation of the colourspace chunkgs but do not require support for
* those chunks so are outside the "COLORSPACE" check but before the write of
* the colourspace chunks themselves.
*/
#ifdef PNG_WRITE_cLLI_SUPPORTED
if ((info_ptr->valid & PNG_INFO_cLLI) != 0)
{
png_write_cLLI_fixed(png_ptr, info_ptr->maxCLL, info_ptr->maxFALL);
}
#endif
#ifdef PNG_WRITE_mDCV_SUPPORTED
if ((info_ptr->valid & PNG_INFO_mDCV) != 0)
{
png_write_mDCV_fixed(png_ptr,
info_ptr->mastering_red_x, info_ptr->mastering_red_y,
info_ptr->mastering_green_x, info_ptr->mastering_green_y,
info_ptr->mastering_blue_x, info_ptr->mastering_blue_y,
info_ptr->mastering_white_x, info_ptr->mastering_white_y,
info_ptr->mastering_maxDL, info_ptr->mastering_minDL);
}
#endif
#ifdef PNG_COLORSPACE_SUPPORTED
# ifdef PNG_WRITE_cICP_SUPPORTED /* Priority 4 */
if ((info_ptr->valid & PNG_INFO_cICP) != 0)

@ -1511,6 +1511,50 @@ png_write_cICP(png_structrp png_ptr,
}
#endif
#ifdef PNG_WRITE_cLLI_SUPPORTED
void /* PRIVATE */
png_write_cLLI_fixed(png_structrp png_ptr, png_uint_32 maxCLL,
png_uint_32 maxFALL)
{
png_byte buf[8];
png_debug(1, "in png_write_cLLI_fixed");
png_save_uint_32(buf, maxCLL);
png_save_uint_32(buf + 4, maxFALL);
png_write_complete_chunk(png_ptr, png_cLLI, buf, 8);
}
#endif
#ifdef PNG_WRITE_mDCV_SUPPORTED
void /* PRIVATE */
png_write_mDCV_fixed(png_structrp png_ptr,
png_uint_16 red_x, png_uint_16 red_y,
png_uint_16 green_x, png_uint_16 green_y,
png_uint_16 blue_x, png_uint_16 blue_y,
png_uint_16 white_x, png_uint_16 white_y,
png_uint_32 maxDL, png_uint_32 minDL)
{
png_byte buf[24];
png_debug(1, "in png_write_mDCV_fixed");
png_save_uint_16(buf + 0, red_x);
png_save_uint_16(buf + 2, red_y);
png_save_uint_16(buf + 4, green_x);
png_save_uint_16(buf + 6, green_y);
png_save_uint_16(buf + 8, blue_x);
png_save_uint_16(buf + 10, blue_y);
png_save_uint_16(buf + 12, white_x);
png_save_uint_16(buf + 14, white_y);
png_save_uint_32(buf + 16, maxDL);
png_save_uint_32(buf + 20, minDL);
png_write_complete_chunk(png_ptr, png_mDCV, buf, 24);
}
#endif
#ifdef PNG_WRITE_eXIf_SUPPORTED
/* Write the Exif data */
void /* PRIVATE */

@ -8,6 +8,7 @@ Scripts and makefiles for libpng
makefile.atari => Atari makefile
makefile.bc32 => Borland C makefile, for Win32
makefile.beos => BeOS makefile
makefile.c89 => Generic UNIX makefile for C89 (cc -std=c89)
makefile.clang => Generic clang makefile
makefile.darwin => Darwin makefile, for macOS (formerly Mac OS X)
makefile.dec => DEC Alpha UNIX makefile

@ -11,7 +11,7 @@
# Modeled after libxml-config.
version=1.6.45
version=1.6.46
prefix=""
libdir=""
libs=""

@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
Name: libpng
Description: Loads and saves PNG files
Version: 1.6.45
Version: 1.6.46
Libs: -L${libdir} -lpng16
Cflags: -I${includedir}

@ -1,6 +1,6 @@
# makefile for libpng on Solaris 2.x with cc
# Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
@ -36,13 +36,10 @@ SUN_LD_FLAGS=-fast -xtarget=ultra
ZLIBLIB=/usr/lib
ZLIBINC=/usr/include
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=$(SUN_CC_FLAGS) # $(WARNMORE) -g
CFLAGS=$(SUN_CC_FLAGS) # -g
ARFLAGS=rc
LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm
LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm # -g
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
@ -53,7 +50,7 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c

@ -1,6 +1,6 @@
# makefile for libpng on Solaris 2.x with cc
# Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
@ -36,13 +36,10 @@ SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9
ZLIBLIB=/usr/lib
ZLIBINC=/usr/include
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=$(SUN_CC_FLAGS) # $(WARNMORE) -g
CFLAGS=$(SUN_CC_FLAGS) # -g
ARFLAGS=rc
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm # -g
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
@ -53,7 +50,7 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c

@ -1,5 +1,5 @@
# makefile for libpng using gcc (generic, static library)
# Copyright (C) 2000, 2020-2024 Cosmin Truta
# Copyright (C) 2000, 2020-2025 Cosmin Truta
# Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
@ -22,9 +22,8 @@ RM_F = rm -f
LIBNAME = libpng16
PNGMAJ = 16
WARNMORE =
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS = -O2 -Wall -Wextra -Wundef # $(WARNMORE) -g
CFLAGS = -O2 # -g
ARFLAGS = rc
LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g
@ -35,7 +34,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
# Targets
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: $(LIBNAME).a pngtest

@ -1,5 +1,5 @@
# makefile for libpng
# Copyright (C) 2022 Cosmin Truta
# Copyright (C) 2022-2025 Cosmin Truta
# Copyright (C) 2002, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -28,7 +28,7 @@ OBJS = $(LBR)(png.o) $(LBR)(pngerror.o) $(LBR)(pngget.o) $(LBR)(pngmem.o) \
all: $(LBR) pngtest.ttp
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c
$(LBR): $(OBJS)

@ -1,6 +1,6 @@
# makefile for libpng on BeOS x86 ELF with gcc
# modified from makefile.linux by Sander Stoks
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2020-2025 Cosmin Truta
# Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
@ -33,14 +33,10 @@ ALIGN=
# For i386:
# ALIGN=-malign-loops=2 -malign-functions=2
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
# On BeOS, -O1 is actually better than -O3. This is a known bug but it's
# still here in R4.5
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=-O1 -funroll-loops $(ALIGN) -Wall -Wextra -Wundef # $(WARNMORE) -g
CFLAGS=-O1 -funroll-loops $(ALIGN) # -g
ARFLAGS=rc
# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz
LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz # -g
@ -58,7 +54,7 @@ OBJSDLL = $(OBJS)
.SUFFIXES: .c .o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: libpng.a $(LIBSO) pngtest

@ -0,0 +1,97 @@
# makefile for libpng using an ANSI C89 compiler
# Copyright (C) 2000, 2014, 2019-2025 Cosmin Truta
# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Location of the zlib library and include files
ZLIBINC = ../zlib
ZLIBLIB = ../zlib
# Compiler, linker, lib and other tools
#CC = c89
CC = cc
LD = $(CC)
AR = ar
RANLIB = ranlib
CP = cp
RM_F = rm -f
# Compiler and linker flags
NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
STDC = -pedantic-errors -std=c89
WARN = -Wall -Wextra -Wundef
WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
LOCAL_CPPFLAGS = $(NOHWOPT)
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE)
CFLAGS = -O2 # -g
ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
ARFLAGS = rc
LDFLAGS = -L$(ZLIBLIB) # -g
LIBS = -lz -lm
# File extensions
EXEEXT =
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
# File lists
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
# Targets
all: static
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
.c.o:
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
static: libpng.a pngtest$(EXEEXT)
shared:
@echo This is a generic makefile that cannot create shared libraries.
@echo Please use a configuration that is specific to your platform.
@false
libpng.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
$(RANLIB) $@
test: pngtest$(EXEEXT)
./pngtest$(EXEEXT)
pngtest$(EXEEXT): pngtest.o libpng.a
$(LD) $(LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS)
clean:
$(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h

@ -1,5 +1,5 @@
# makefile for libpng using clang (generic, static library)
# Copyright (C) 2000, 2014, 2019-2024 Cosmin Truta
# Copyright (C) 2000, 2014, 2019-2025 Cosmin Truta
# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -21,13 +21,17 @@ RM_F = rm -f
# Compiler and linker flags
NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
DEFS = $(NOHWOPT)
CPPFLAGS = -I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5
CFLAGS = -O2 -Wall -Wextra -Wundef # $(WARNMORE) -g
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
STDC = -pedantic-errors # -std=c99
WARN = -Wall -Wextra -Wundef
WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
LOCAL_CPPFLAGS = $(NOHWOPT)
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE)
CFLAGS = -O2 # -g
ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
ARFLAGS = rc
LDFLAGS = -L$(ZLIBLIB) # -g
LIBS = -lz -lm
@ -51,7 +55,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
static: libpng.a pngtest$(EXEEXT)

@ -1,5 +1,5 @@
# makefile for libpng on Darwin / macOS
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2014, 2018-2025 Cosmin Truta
# Copyright (C) 2002, 2004, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 2001 Christoph Pfisterer
# derived from makefile.linux:
@ -10,10 +10,6 @@
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Where the zlib library and include files are located
ZLIBLIB=/usr/lib
ZLIBINC=/usr/include
# Library name:
LIBNAME=libpng16
PNGMAJ=16
@ -30,13 +26,22 @@ LN_SF=ln -sf
CP=cp
RM_F=rm -f
NOHWOPT=-DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
DEFS=$(NOHWOPT)
CPPFLAGS=-I$(ZLIBINC) $(DEFS)
CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef
ARFLAGS=rc
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz
# Compiler and linker flags
NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
STDC = -pedantic-errors
WARN = -Wall -Wextra -Wundef
WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
LOCAL_CPPFLAGS = $(NOHWOPT)
CPPFLAGS = # -DPNG_DEBUG=5
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE)
CFLAGS = -O3 -funroll-loops # -g
ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
ARFLAGS = rc
LDFLAGS = -L. -lpng16 -lz # -g
LDFLAGS_A = libpng.a -lz -lm # -g
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
@ -52,12 +57,12 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fno-common -o $@ $*.c
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -fno-common -o $@ $*.c
all: libpng.a $(LIBSO) pngtest
all: libpng.a $(LIBSO) pngtest pngtest-static
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
@ -71,15 +76,25 @@ $(LIBSO): $(LIBSOMAJ)
$(LIBSOMAJ): $(OBJSDLL)
$(CC) -dynamiclib \
-current_version 16 -compatibility_version 16 \
-o $(LIBSOMAJ) \
$(OBJSDLL) -L$(ZLIBLIB) -lz
-current_version 16 -compatibility_version 16 \
-o $(LIBSOMAJ) \
$(OBJSDLL) -lz
pngtest: pngtest.o $(LIBSO)
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
test: pngtest
pngtest-static: pngtest.o libpng.a
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
test: pngtest pngtest-static
@echo ""
@echo " Running pngtest dynamically linked with $(LIBSO):"
@echo ""
./pngtest
@echo ""
@echo " Running pngtest statically linked with libpng.a:"
@echo ""
./pngtest-static
install:
@echo "The $@ target is no longer supported by this makefile."
@ -94,8 +109,9 @@ install-shared:
@false
clean:
$(RM_F) *.o libpng.a pngtest pngout.png
$(RM_F) $(OBJS) $(OBJSDLL) libpng.a
$(RM_F) $(LIBNAME).*dylib pnglibconf.h
$(RM_F) pngtest*.o pngtest pngtest-static pngout.png
# DO NOT DELETE THIS LINE -- make depend depends on it.

@ -1,5 +1,5 @@
# makefile for libpng on DEC Alpha Unix
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2020-2025 Cosmin Truta
# Copyright (C) 2000-2002, 2006, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -30,7 +30,7 @@ ZLIBLIB=../zlib
ZLIBINC=../zlib
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=-std -w1 -O # -g
CFLAGS=-std -w1 -O
ARFLAGS=rc
LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
@ -43,7 +43,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: $(LIBSO) libpng.a pngtest

@ -1,5 +1,5 @@
# DJGPP (DOS gcc) makefile for libpng
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2020-2025 Cosmin Truta
# Copyright (C) 2002, 2006, 2009-2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -11,7 +11,7 @@ CC=gcc
AR=ar
RANLIB=ranlib
CPPFLAGS=-I../zlib -DPNG_NO_SNPRINTF
CFLAGS=-O
CFLAGS=-O2 -Wall -Wextra -Wundef
ARFLAGS=rc
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
@ -27,7 +27,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: libpng.a pngtest

@ -1,5 +1,5 @@
# makefile for libpng using emscripten
# Copyright (C) 2000, 2014, 2019-2024 Cosmin Truta
# Copyright (C) 2000, 2014, 2019-2025 Cosmin Truta
# Copyright (C) 2021 Kirk Roerig
# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
@ -20,8 +20,16 @@ RANLIB = emranlib
CP = cp
RM_F = rm -f
STDC = -pedantic-errors # -std=c99
WARN = -Wall -Wextra -Wundef
WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
LOCAL_CPPFLAGS =
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS = -O2 -Wall -Wextra -Wundef
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE)
CFLAGS = -O2
ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
ARFLAGS = rc
LDFLAGS = -L$(ZLIBLIB)
PNGTEST_LDFLAGS = --preload-file=pngtest.png
@ -43,7 +51,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
static: libpng.a pngtest

@ -1,5 +1,5 @@
# makefile for libpng under FreeBSD
# Copyright (C) 2020-2022 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2014 Glenn Randers-Pehrson and Andrey A. Chernov
# Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov
#
@ -35,7 +35,7 @@ SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c
.c.o:
${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $<
${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $*.c
pnglibconf.h: ${PNGLIBCONF_H_PREBUILT}
cp ${PNGLIBCONF_H_PREBUILT} $@

@ -1,5 +1,5 @@
# makefile for libpng using gcc (generic, static library)
# Copyright (C) 2000, 2014, 2019-2024 Cosmin Truta
# Copyright (C) 2000, 2014, 2019-2025 Cosmin Truta
# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -21,13 +21,17 @@ RM_F = rm -f
# Compiler and linker flags
NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
DEFS = $(NOHWOPT)
CPPFLAGS = -I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5
CFLAGS = -O2 -Wall -Wextra -Wundef # $(WARNMORE) -g
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
STDC = -pedantic-errors # -std=c99
WARN = -Wall -Wextra -Wundef
WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
LOCAL_CPPFLAGS = $(NOHWOPT)
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE)
CFLAGS = -O2 # -g
ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
ARFLAGS = rc
LDFLAGS = -L$(ZLIBLIB) # -g
LIBS = -lz -lm
@ -51,7 +55,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
static: libpng.a pngtest$(EXEEXT)

@ -1,5 +1,5 @@
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 1999-2002, 2006, 2009, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
# Contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
@ -56,7 +56,7 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c

@ -1,5 +1,5 @@
# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2002, 2006-2008, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 2001, Laurent faillie
# Copyright (C) 1998, 1999 Greg Roelofs
@ -37,12 +37,8 @@ ZLIBINC=/opt/zlib/include
# LDSHARED=ld -b
# SHAREDLIB=libz.sl
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef # $(WARNMORE) -g
CFLAGS=-O3 -funroll-loops # -g
ARFLAGS=rc
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm # -g
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g
@ -56,7 +52,7 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c

@ -1,5 +1,5 @@
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
# Contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
@ -55,7 +55,7 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c

@ -1,7 +1,7 @@
# Makefile for libpng (static)
# IBM C version 3.x for Win32 and OS/2
# Copyright (C) 2006, 2014 Glenn Randers-Pehrson
# Copyright (C) 2000, 2020 Cosmin Truta
# Copyright (C) 2000, 2020-2025 Cosmin Truta
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
@ -46,7 +46,7 @@ LIBS = libpng$(A) $(ZLIBLIB)/zlib$(A)
# Targets
.c$(O):
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c
all: libpng$(A) pngtest$(E)

@ -1,5 +1,5 @@
# makefile for libpng.a and libpng16.so on Linux ELF with gcc
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
# Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger
@ -24,24 +24,22 @@ LN_SF=ln -sf
CP=cp
RM_F=rm -f
# Where the zlib library and include files are located.
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib
# Compiler and linker flags
NOHWOPT=-DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
DEFS=$(NOHWOPT)
CPPFLAGS=-I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5
CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef # $(WARNMORE) -g
ARFLAGS=rc
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm # -g
LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm # -g
NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
STDC = -pedantic-errors
WARN = -Wall -Wextra -Wundef
WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
LOCAL_CPPFLAGS = $(NOHWOPT)
CPPFLAGS = # -DPNG_DEBUG=5
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE)
CFLAGS = -O3 -funroll-loops # -g
ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
ARFLAGS = rc
LDFLAGS = -L. -Wl,-rpath,. -lpng16 -lz -lm # -g
LDFLAGS_A = libpng.a -lz -lm # -g
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
@ -57,10 +55,10 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -fPIC -o $@ $*.c
all: libpng.a $(LIBSO) pngtest pngtest-static

@ -1,5 +1,5 @@
# makefile for libpng
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 1998-2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -26,7 +26,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: libpng.a pngtest

@ -1,5 +1,5 @@
# makefile for libpng using MSYS/gcc (shared, static library)
# Copyright (C) 2000, 2019-2024 Cosmin Truta
# Copyright (C) 2000, 2019-2025 Cosmin Truta
# Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler
#
# Portions taken from makefile.linux and makefile.gcc:
@ -21,23 +21,28 @@ PNGMAJ=16
LIBSO=$(LIBNAME).dll
LIBSOMAJ=$(LIBNAME).dll.$(PNGMAJ)
# Where the zlib library and include files are located.
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
# Compiler, linker, lib and other tools
CC = gcc
LD = $(CC)
AR = ar
RANLIB = ranlib
CP = cp
RM_F = rm -rf
RM_F = rm -f
LN_SF = ln -sf
# Compiler and linker flags
NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
STDC = -pedantic-errors
WARN = -Wall -Wextra -Wundef
WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
LOCAL_CPPFLAGS = $(NOHWOPT)
CPPFLAGS = # -DPNG_DEBUG=5
CFLAGS = -O2 -Wall -Wextra -Wundef # -g
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE)
CFLAGS = -O2 # -g
ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
ARFLAGS = rc
LDFLAGS = # -g
LIBS = -lz -lm
@ -61,7 +66,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
static: libpng.a pngtest$(EXEEXT)

@ -1,5 +1,5 @@
# makefile for libpng on NetBSD
# Copyright (C) 2020-2022 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2007-2009, 2014 Glenn Randers-Pehrson
# Copyright (C) 2002 Patrick R.L. Welche
#
@ -32,7 +32,7 @@ PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
# .endif
.c.o:
${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $<
${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $*.c
pnglibconf.h: ${PNGLIBCONF_H_PREBUILT}
cp ${PNGLIBCONF_H_PREBUILT} $@

@ -1,5 +1,5 @@
# makefile for libpng
# Copyright (C) 2020-2022 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2007-2009, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -26,7 +26,7 @@ CLEANFILES+= pngtest.o pngtest pnglibconf.h
PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
.c.o:
${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $<
${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $*.c
pnglibconf.h: ${PNGLIBCONF_H_PREBUILT}
cp ${PNGLIBCONF_H_PREBUILT} $@

@ -1,7 +1,7 @@
# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
# Contributed by Mike Hopkirk (hops at sco.com) modified from Makefile.lnx
# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
@ -50,7 +50,7 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c

@ -1,5 +1,5 @@
# makefile for libpng.a and libpng16.so, SGI IRIX with 'cc'
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2001-2002, 2006, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -35,9 +35,8 @@ ZLIBINC=../zlib
# See "man abi". zlib must be built with the same ABI.
ABI=
WARNMORE=
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=$(ABI) -O $(WARNMORE) -fPIC -mabi=n32 # -g
CFLAGS=$(ABI) -O -fPIC -mabi=n32 # -g
ARFLAGS=rc
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm # -g
LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
@ -53,7 +52,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: libpng.a pngtest shared

@ -1,5 +1,5 @@
# makefile for libpng.a and libpng16.so, SGI IRIX with 'cc'
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2001-2002, 2006, 2007, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -35,11 +35,10 @@ ZLIBINC=../zlib
# See "man abi". zlib must be built with the same ABI.
ABI=
WARNMORE=-fullwarn
# Note: -KPIC is the default anyhow
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
#CFLAGS= $(ABI) -O $(WARNMORE) -KPIC # -g
CFLAGS=$(ABI) -O $(WARNMORE) # -g
#CFLAGS=$(ABI) -O -fullwarn -KPIC # -g
CFLAGS=$(ABI) -O -fullwarn # -g
ARFLAGS=rc
LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm # -g
@ -56,7 +55,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: libpng.a pngtest shared

@ -1,7 +1,7 @@
# makefile for libpng on Solaris 9 (beta) with Forte cc
# Updated by Chad Schrock for Solaris 9
# Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1998-2001 Greg Roelofs
# Copyright (C) 1996-1997 Andreas Dilger
@ -19,7 +19,6 @@ LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
# Utilities:
# gcc 2.95 doesn't work.
CC=cc
AR=ar
RANLIB=echo
@ -56,7 +55,7 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c

@ -1,5 +1,5 @@
# makefile for libpng on Solaris 2.x with gcc
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2004, 2006-2008, 2010-2014 Glenn Randers-Pehrson
# Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 1998 Greg Roelofs
@ -34,11 +34,8 @@ RM_F=/bin/rm -f
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=-O -Wall -Wextra -Wundef # $(WARNMORE) -g
CFLAGS=-O # -g
ARFLAGS=rc
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm # -g
@ -55,7 +52,7 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c

@ -1,5 +1,5 @@
# makefile for libpng
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2015, 2018-2025 Cosmin Truta
# Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -23,7 +23,7 @@ RM_F = rm -f
AWK = awk
NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
-DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build
DFA_EXTRA = # extra files that can be used to control configuration
CPPFLAGS = -I$(ZLIBINC) $(NOHWOPT) # -DPNG_DEBUG=5
@ -41,7 +41,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: libpng.a pngtest

@ -1,5 +1,5 @@
# makefile for libpng
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2018-2025 Cosmin Truta
# Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@ -33,7 +33,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c
all: libpng.a pngtest

@ -847,11 +847,13 @@ setting IDAT_READ_SIZE default PNG_ZBUF_SIZE
chunk bKGD
chunk cHRM enables COLORSPACE
chunk cICP enables COLORSPACE, GAMMA
chunk cLLI
chunk eXIf
chunk gAMA enables GAMMA
chunk hIST
chunk iCCP enables COLORSPACE, GAMMA
chunk iTXt enables TEXT
chunk mDCV
chunk oFFs
chunk pCAL
chunk pHYs

@ -1,6 +1,6 @@
/* pnglibconf.h - library build configuration */
/* libpng version 1.6.45 */
/* libpng version 1.6.46 */
/* Copyright (c) 2018-2025 Cosmin Truta */
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
@ -89,11 +89,13 @@
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_cICP_SUPPORTED
#define PNG_READ_cLLI_SUPPORTED
#define PNG_READ_eXIf_SUPPORTED
#define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_hIST_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_iTXt_SUPPORTED
#define PNG_READ_mDCV_SUPPORTED
#define PNG_READ_oFFs_SUPPORTED
#define PNG_READ_pCAL_SUPPORTED
#define PNG_READ_pHYs_SUPPORTED
@ -160,11 +162,13 @@
#define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_cICP_SUPPORTED
#define PNG_WRITE_cLLI_SUPPORTED
#define PNG_WRITE_eXIf_SUPPORTED
#define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_hIST_SUPPORTED
#define PNG_WRITE_iCCP_SUPPORTED
#define PNG_WRITE_iTXt_SUPPORTED
#define PNG_WRITE_mDCV_SUPPORTED
#define PNG_WRITE_oFFs_SUPPORTED
#define PNG_WRITE_pCAL_SUPPORTED
#define PNG_WRITE_pHYs_SUPPORTED
@ -179,11 +183,13 @@
#define PNG_bKGD_SUPPORTED
#define PNG_cHRM_SUPPORTED
#define PNG_cICP_SUPPORTED
#define PNG_cLLI_SUPPORTED
#define PNG_eXIf_SUPPORTED
#define PNG_gAMA_SUPPORTED
#define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED
#define PNG_iTXt_SUPPORTED
#define PNG_mDCV_SUPPORTED
#define PNG_oFFs_SUPPORTED
#define PNG_pCAL_SUPPORTED
#define PNG_pHYs_SUPPORTED

@ -255,3 +255,11 @@ EXPORTS
png_set_eXIf_1 @249
png_get_cICP @250
png_set_cICP @251
png_get_cLLI @252
png_get_cLLI_fixed @253
png_set_cLLI @254
png_set_cLLI_fixed @255
png_get_mDCV @256
png_get_mDCV_fixed @257
png_set_mDCV @258
png_set_mDCV_fixed @259

Loading…
Cancel
Save