Solaris  - libpng (3)


libpng - Portable Network Graphics (PNG) Reference Library



#include <png.h>

cc [ flag ...] -I/usr/sfw/include file [ library ... ] - L/usr/sfw/lib -R/usr/sfw/lib -lpng

png_uint_32 png_access_version_number (void);

int png_check_sig (png_bytep sig, int num);

void png_chunk_error (png_structp png_ptr, png_const_charp error);

void png_chunk_warning (png_structp png_ptr, png_const_charp message);

void png_convert_from_struct_tm (png_timep ptime, struct tm FAR * ttime);

void png_convert_from_time_t (png_timep ptime, time_t ttime);

png_charp png_convert_to_rfc1124 (png_structp png_ptr, png_timep ptime);

png_infop png_create_info_struct (png_structp png_ptr);

png_structp png_create_read_struct (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn);

png_structp png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn);

png_structp png_create_write_struct (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn);

png_structp png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn);

int png_debug(int level, png_const_charp message);

int png_debug1(int level, png_const_charp message, p1);

int png_debug2(int level, png_const_charp message, p1, p2);

void png_destroy_info_struct (png_structp png_ptr, png_infopp info_ptr_ptr);

void png_destroy_read_struct (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr);

void png_destroy_write_struct (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr);

void png_error (png_structp png_ptr, png_const_charp error);

void png_free (png_structp png_ptr, png_voidp ptr);

void png_free_chunk_list (png_structp png_ptr);

void png_free_default(png_structp png_ptr, png_voidp ptr);

void png_free_data (png_structp png_ptr, png_infop info_ptr, int num);

png_byte png_get_bit_depth (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_bKGD (png_structp png_ptr, png_infop info_ptr, png_color_16p *background);

png_byte png_get_channels (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_cHRM (png_structp png_ptr, png_infop 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);

png_uint_32 png_get_cHRM_fixed (png_structp png_ptr, png_infop info_ptr, png_uint_32 *white_x, png_uint_32 *white_y, png_uint_32 *red_x, png_uint_32 *red_y, png_uint_32 *green_x, png_uint_32 *green_y, png_uint_32 *blue_x, png_uint_32 *blue_y);

png_byte png_get_color_type (png_structp png_ptr, png_infop info_ptr);

png_byte png_get_compression_type (png_structp png_ptr, png_infop info_ptr);

png_byte png_get_copyright (png_structp png_ptr);

png_voidp png_get_error_ptr (png_structp png_ptr);

png_byte png_get_filter_type (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_gAMA (png_structp png_ptr, png_infop info_ptr, double *file_gamma);

png_uint_32 png_get_gAMA_fixed (png_structp png_ptr, png_infop info_ptr, png_uint_32 *int_file_gamma);

png_byte png_get_header_ver (png_structp png_ptr);

png_byte png_get_header_version (png_structp png_ptr);

png_uint_32 png_get_hIST (png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist);

png_uint_32 png_get_iCCP (png_structp png_ptr, png_infop info_ptr, png_charpp name, int *compression_type, png_charpp profile, png_uint_32 *proflen);

png_uint_32 png_get_IHDR (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_type, int *compression_type, int *filter_type);

png_uint_32 png_get_image_height (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_image_width (png_structp png_ptr, png_infop info_ptr);

png_byte png_get_interlace_type (png_structp png_ptr, png_infop info_ptr);

png_voidp png_get_io_ptr (png_structp png_ptr);

png_byte png_get_libpng_ver (png_structp png_ptr);

png_voidp png_get_mem_ptr(png_structp png_ptr);

png_uint_32 png_get_oFFs (png_structp png_ptr, png_infop info_ptr, png_uint_32 *offset_x, png_uint_32 *offset_y, int *unit_type);

png_uint_32 png_get_pCAL (png_structp png_ptr, png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params);

png_uint_32 png_get_pHYs (png_structp png_ptr, png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type);

float png_get_pixel_aspect_ratio (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_pixels_per_meter (png_structp png_ptr, png_infop info_ptr);

png_voidp png_get_progressive_ptr (png_structp png_ptr);

png_uint_32 png_get_PLTE (png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette);

png_byte png_get_rgb_to_gray_status (png_structp png_ptr)

png_uint_32 png_get_rowbytes (png_structp png_ptr, png_infop info_ptr);

png_bytepp png_get_rows (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_sBIT (png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit);

png_bytep png_get_signature (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_sPLT (png_structp png_ptr, png_infop info_ptr, png_spalette_p *splt_ptr);

png_uint_32 png_get_sRGB (png_structp png_ptr, png_infop info_ptr, int *intent);

png_uint_32 png_get_text (png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, int *num_text);

png_uint_32 png_get_tIME (png_structp png_ptr, png_infop info_ptr, png_timep *mod_time);

png_uint_32 png_get_tRNS (png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values);

png_uint_32 png_get_unknown_chunks (png_structp png_ptr, png_infop info_ptr, png_unknown_chunkpp unknowns);

png_voidp png_get_user_chunk_ptr (png_structp png_ptr);

png_voidp png_get_user_transform_ptr (png_structp png_ptr);

png_uint_32 png_get_valid (png_structp png_ptr, png_infop info_ptr, png_uint_32 flag);

png_int_32 png_get_x_offset_microns (png_structp png_ptr, png_infop info_ptr);

png_int_32 png_get_x_offset_pixels (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_x_pixels_per_meter (png_structp png_ptr, png_infop info_ptr);

png_int_32 png_get_y_offset_microns (png_structp png_ptr, png_infop info_ptr);

png_int_32 png_get_y_offset_pixels (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_y_pixels_per_meter (png_structp png_ptr, png_infop info_ptr);

png_uint_32 png_get_compression_buffer_size (png_structp png_ptr);

void png_info_init (png_infop info_ptr);

void png_init_io (png_structp png_ptr, FILE *fp);

png_voidp png_malloc (png_structp png_ptr, png_uint_32 size);

png_voidp png_malloc_default(png_structp png_ptr, png_uint_32 size);

voidp png_memcpy (png_voidp s1, png_voidp s2, png_size_t size);

png_voidp png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2, png_uint_32 size);

voidp png_memset (png_voidp s1, int value, png_size_t size);

png_voidp png_memset_check (png_structp png_ptr, png_voidp s1, int value, png_uint_32 size);

void png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted);

void png_process_data (png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size);

void png_progressive_combine_row (png_structp png_ptr, png_bytep old_row, png_bytep new_row);

void png_read_destroy (png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr);

void png_read_end (png_structp png_ptr, png_infop info_ptr);

void png_read_image (png_structp png_ptr, png_bytepp image);

DEPRECATED: void png_read_init (png_structp png_ptr);

DEPRECATED: void png_read_init_2 (png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size);

void png_read_info (png_structp png_ptr, png_infop info_ptr);

void png_read_png (png_structp png_ptr, png_infop info_ptr, int transforms, png_voidp params);

void png_read_row (png_structp png_ptr, png_bytep row, png_bytep display_row);

void png_read_rows (png_structp png_ptr, png_bytepp row, png_bytepp display_row, png_uint_32 num_rows);

void png_read_update_info (png_structp png_ptr, png_infop info_ptr);

void png_set_background (png_structp png_ptr, png_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma);

void png_set_bgr (png_structp png_ptr);

void png_set_bKGD (png_structp png_ptr, png_infop info_ptr, png_color_16p background);

void png_set_cHRM (png_structp png_ptr, png_infop 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);

void png_set_cHRM_fixed (png_structp png_ptr, png_infop info_ptr, png_uint_32 white_x, png_uint_32 white_y, png_uint_32 red_x, png_uint_32 red_y, png_uint_32 green_x, png_uint_32 green_y, png_uint_32 blue_x, png_uint_32 blue_y);

void png_set_compression_level (png_structp png_ptr, int level);

void png_set_compression_mem_level (png_structp png_ptr, int mem_level);

void png_set_compression_method (png_structp png_ptr, int method);

void png_set_compression_strategy (png_structp png_ptr, int strategy);

void png_set_compression_window_bits (png_structp png_ptr, int window_bits);

void png_set_crc_action (png_structp png_ptr, int crit_action, int ancil_action);

void png_set_dither (png_structp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_uint_16p histogram, int full_dither);

void png_set_error_fn (png_structp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn);

void png_set_expand (png_structp png_ptr);

void png_set_filler (png_structp png_ptr, png_uint_32 filler, int flags);

void png_set_filter (png_structp png_ptr, int method, int filters);

void png_set_filter_heuristics (png_structp png_ptr, int heuristic_method, int num_weights, png_doublep filter_weights, png_doublep filter_costs);

void png_set_flush (png_structp png_ptr, int nrows);

void png_set_gamma (png_structp png_ptr, double screen_gamma, double default_file_gamma);

void png_set_gAMA (png_structp png_ptr, png_infop info_ptr, double file_gamma);

void png_set_gAMA_fixed (png_structp png_ptr, png_infop info_ptr, png_uint_32 file_gamma);

void png_set_gray_1_2_4_to_8(png_structp png_ptr);

void png_set_gray_to_rgb (png_structp png_ptr);

void png_set_hIST (png_structp png_ptr, png_infop info_ptr, png_uint_16p hist);

void png_set_iCCP (png_structp png_ptr, png_infop info_ptr, png_charp name, int compression_type, png_charp profile, png_uint_32 proflen);

int png_set_interlace_handling (png_structp png_ptr);

void png_set_invalid (png_structp png_ptr, png_infop info_ptr, int mask);

void png_set_invert_alpha (png_structp png_ptr);

void png_set_invert_mono (png_structp png_ptr);

void png_set_IHDR (png_structp png_ptr, png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int interlace_type, int compression_type, int filter_type);

void png_set_keep_unknown_chunks (png_structp png_ptr, int keep, png_bytep chunk_list, int num_chunks);

void png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn);

void png_set_oFFs (png_structp png_ptr, png_infop info_ptr, png_uint_32 offset_x, png_uint_32 offset_y, int unit_type);

void png_set_packing (png_structp png_ptr);

void png_set_packswap (png_structp png_ptr);

void png_set_palette_to_rgb(png_structp png_ptr);

void png_set_pCAL (png_structp png_ptr, png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_charp units, png_charpp params);

void png_set_pHYs (png_structp png_ptr, png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type);

void png_set_progressive_read_fn (png_structp png_ptr, png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn);

void png_set_PLTE (png_structp png_ptr, png_infop info_ptr, png_colorp palette, int num_palette);

void png_set_read_fn (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn);

void png_set_read_status_fn (png_structp png_ptr, png_read_status_ptr read_row_fn);

void png_set_read_user_transform_fn (png_structp png_ptr, png_user_transform_ptr read_user_transform_fn);

void png_set_rgb_to_gray (png_structp png_ptr, int error_action, double red, double green);

void png_set_rgb_to_gray_fixed (png_structp png_ptr, int error_action png_fixed_point red, png_fixed_point green);

void png_set_rows (png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers);

void png_set_sBIT (png_structp png_ptr, png_infop info_ptr, png_color_8p sig_bit);

void png_set_sCAL (png_structp png_ptr, png_infop info_ptr, png_charp unit, double width, double height);

void png_set_shift (png_structp png_ptr, png_color_8p true_bits);

void png_set_sig_bytes (png_structp png_ptr, int num_bytes);

void png_set_sPLT (png_structp png_ptr, png_infop info_ptr, png_spalette_p splt_ptr, int num_spalettes);

void png_set_sRGB (png_structp png_ptr, png_infop info_ptr, int intent);

void png_set_sRGB_gAMA_and_cHRM (png_structp png_ptr, png_infop info_ptr, int intent);

void png_set_strip_16 (png_structp png_ptr);

void png_set_strip_alpha (png_structp png_ptr);

void png_set_swap (png_structp png_ptr);

void png_set_swap_alpha (png_structp png_ptr);

void png_set_text (png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, int num_text);

void png_set_tIME (png_structp png_ptr, png_infop info_ptr, png_timep mod_time);

void png_set_tRNS (png_structp png_ptr, png_infop info_ptr, png_bytep trans, int num_trans, png_color_16p trans_values);

void png_set_tRNS_to_alpha(png_structp png_ptr);

png_uint_32 png_set_unknown_chunks (png_structp png_ptr, png_infop info_ptr, png_unknown_chunkp unknowns, int num, int location);

void png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr, int chunk, int location);

void png_set_read_user_chunk_fn (png_structp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn);

void png_set_user_transform_info (png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels);

void png_set_write_fn (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn);

void png_set_write_status_fn (png_structp png_ptr, png_write_status_ptr write_row_fn);

void png_set_write_user_transform_fn (png_structp png_ptr, png_user_transform_ptr write_user_transform_fn);

void png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size);

int png_sig_cmp (png_bytep sig, png_size_t start, png_size_t num_to_check);

void png_start_read_image (png_structp png_ptr);

void png_warning (png_structp png_ptr, png_const_charp mes- sage);

void png_write_chunk (png_structp png_ptr, png_bytep chunk_name, png_bytep data, png_size_t length);

void png_write_chunk_data (png_structp png_ptr, png_bytep data, png_size_t length);

void png_write_chunk_end (png_structp png_ptr);

void png_write_chunk_start (png_structp png_ptr, png_bytep chunk_name, png_uint_32 length);

void png_write_destroy (png_structp png_ptr);

void png_write_destroy_info (png_infop info_ptr);

void png_write_end (png_structp png_ptr, png_infop info_ptr);

void png_write_flush (png_structp png_ptr);

void png_write_image (png_structp png_ptr, png_bytepp image);

DEPRECATED: void png_write_init (png_structp png_ptr);

DEPRECATED: void png_write_init_2 (png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size);

void png_write_info (png_structp png_ptr, png_infop info_ptr);

void png_write_info_before_PLTE (png_structp png_ptr, png_infop info_ptr);

void png_write_png (png_structp png_ptr, png_infop info_ptr, int transforms, png_voidp params);

void png_write_row (png_structp png_ptr, png_bytep row);

void png_write_rows (png_structp png_ptr, png_bytepp row,

png_uint_32 num_rows);




The libpng library supports encoding, decoding, and various manipulations of the Portable Network Graphics (PNG) format image files. The libpng library uses the zlib(3) compression library.

For more information about libpng V1.0.15, see

For more information about libpng V1.2.5, see


    Version Numbers

Due to various miscommunications, unforeseen code incompatibilities and occasional factors outside the authors’ control, version numbering on the library has not always been consistent and straightforward. The following table summarizes matters since version 0.89c, which was the first widely used release.

source versionpng.h stringpng.h intshared-lib version
0.89c ("beta 3")0.89891.0.89
0.90 ("beta 4")0.90900.90
0.95 ("beta 5")0.95950.95
0.96 ("beta 6")0.96960.96
0.97b ("beta 7")1.00.97971.0.1
1.0.1 100012.1.0
1.0.1a-e 10002#
1.0.2 10002 
1.0.2a-b 10003 
1.0.1 10001 
1.0.1a-e 100022.1.0.1a-e
1.0.2 100022.1.0.2
1.0.2a-b 100032.1.0.2a-b
1.0 100032.1.0
1.0a-d 100042.1.0a-d
1.0.4 100042.1.0.4
1.0.4a-f 100052.1.0.4a-f
1.0.5 (+ 2 patches) 100052.1.0.5
1.0.5a-d 100062.1.0.5a-d
1.0.5e-r 101002.1.0.5e-r
1.0.5s-v 100062.1.0.5s-v
1.0.6 (+ 3 patches) 100062.1.0.6
1.0.6d-g 100072.1.0.6d-g
1.0.6h 1000710.6h
1.0.6i 1000710.6i
1.0.6j 100072.1.0.6j

* From this release forward, the png.h string is identical to the source version.

# From this release forward, the shared library is 2.V, where V is the source code version except as noted.

Henceforth, the source version will match the shared-library minor and patch numbers. The shared-library major version number will be used for changes in backward compatibility, as it is intended. The PNG_PNGLIB_VER macro, which is not used within libpng but is available for applications, is an unsigned integer of the form xyyzz corresponding to the source version x.y.z (leading zeros in y and z). Beta versions were given the previous public release number plus a letter, until version 1.0.6j. From then on, they were given the upcoming public release number plus "betaNN" or "rcN".


See attributes(5) for descriptions of the following attributes:

Interface stabilityEvolving


libpngpf(3), png(4)



Generally at the same location as libpng or at


Generally at the same location as libpng or at

or as a W3C Recommendation at

In the case of any inconsistency between the PNG specification and this library, the specification takes precedence.


This man page was originally written by Glenn Randers-Pehrson. Updated by Breda McColgan, Sun Microsystems Inc., 2004.

Jump to page    or go to Top of page |  Section 3 |  OpenSolaris Man Main Index.

SunOS 5.11 libpng (3) 06 Apr 2004
Generated by OpenSolaris Forum from /usr/share/man/man3/libpng.3 using man macros with tbl support.