.TH "pngpack.c" 3 "Version 2.2.0" "NCEPLIBS-g2c" \" -*- nroff -*-
.ad l
.nh
.SH NAME
pngpack.c \- Pack data with PNG compression\&.  

.SH SYNOPSIS
.br
.PP
\fC#include 'grib2_int\&.h'\fP
.br
\fC#include <math\&.h>\fP
.br
\fC#include <stdlib\&.h>\fP
.br

.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBg2c_pngpackd\fP (double *fld, size_t width, size_t height, int *idrstmpl, unsigned char *cpack, int *lcpack)"
.br
.RI "This subroutine packs up a double data field into PNG image format\&. "
.ti -1c
.RI "int \fBg2c_pngpackf\fP (float *fld, size_t width, size_t height, int *idrstmpl, unsigned char *cpack, int *lcpack)"
.br
.RI "This subroutine packs up a float data field into PNG image format\&. "
.ti -1c
.RI "void \fBpngpack\fP (float *fld, \fBg2int\fP width, \fBg2int\fP height, \fBg2int\fP *idrstmpl, unsigned char *cpack, \fBg2int\fP *lcpack)"
.br
.RI "This subroutine packs up a float data field into PNG image format\&. "
.ti -1c
.RI "static int \fBpngpack_int\fP (void *fld, int fld_is_double, \fBg2int\fP width, \fBg2int\fP height, \fBg2int\fP *idrstmpl, unsigned char *cpack, \fBg2int\fP *lcpack, int verbose)"
.br
.RI "Packs float or double data into PNG image format\&. "
.in -1c
.SH "Detailed Description"
.PP 
Pack data with PNG compression\&. 


.PP
\fBAuthor\fP
.RS 4
Stephen Gilbert 
.RE
.PP
\fBDate\fP
.RS 4
2003-08-27 
.RE
.PP

.PP
Definition in file \fBpngpack\&.c\fP\&.
.SH "Function Documentation"
.PP 
.SS "int g2c_pngpackd (double * fld, size_t width, size_t height, int * idrstmpl, unsigned char * cpack, int * lcpack)"

.PP
This subroutine packs up a double data field into PNG image format\&. After the data field is scaled, and the reference value is subtracted out, it is treated as a grayscale image and passed to a PNG encoder\&. It also fills in GRIB2 Data Representation Template 5\&.41 or 5\&.40010 with the appropriate values\&.
.PP
\fBParameters\fP
.RS 4
\fIfld\fP Pointer to array of double that contains the data values to pack\&. 
.br
\fIwidth\fP Number of points in the x direction\&. 
.br
\fIheight\fP Number of points in the y direction\&. 
.br
\fIidrstmpl\fP Contains the array of values for Data Representation \fCTemplate 5\&.41\fP or 5\&.40010\&.
.IP "\(bu" 2
0 Reference value - ignored on input, set by pngpack routine\&.
.IP "\(bu" 2
1 Binary Scale Factor - used on input\&.
.IP "\(bu" 2
2 Decimal Scale Factor - used on input\&.
.IP "\(bu" 2
3 number of bits for each grayscale pixel value - ignored on input\&.
.IP "\(bu" 2
4 Original field type - currently ignored on input, set = 0 on output\&. Data values assumed to be reals\&. 
.PP
.br
\fIcpack\fP The packed data field\&. 
.br
\fIlcpack\fP length of packed field cpack\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.IP "\(bu" 2
\fBG2C_EPNG\fP Error encoding/decoding PNG data\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
Aug 8, 2022 
.RE
.PP

.PP
Definition at line \fB348\fP of file \fBpngpack\&.c\fP\&.
.PP
References \fBG2C_PNG_DRS_TEMPLATE_LEN\fP, and \fBpngpack_int()\fP\&.
.SS "int g2c_pngpackf (float * fld, size_t width, size_t height, int * idrstmpl, unsigned char * cpack, int * lcpack)"

.PP
This subroutine packs up a float data field into PNG image format\&. After the data field is scaled, and the reference value is subtracted out, it is treated as a grayscale image and passed to a PNG encoder\&. It also fills in GRIB2 Data Representation Template 5\&.41 or 5\&.40010 with the appropriate values\&.
.PP
\fBParameters\fP
.RS 4
\fIfld\fP Pointer to array of float that contains the data values to pack\&. 
.br
\fIwidth\fP Number of points in the x direction\&. 
.br
\fIheight\fP Number of points in the y direction\&. 
.br
\fIidrstmpl\fP Contains the array of values for Data Representation \fCTemplate 5\&.41\fP or 5\&.40010\&.
.IP "\(bu" 2
0 Reference value - ignored on input, set by pngpack routine\&.
.IP "\(bu" 2
1 Binary Scale Factor - used on input\&.
.IP "\(bu" 2
2 Decimal Scale Factor - used on input\&.
.IP "\(bu" 2
3 number of bits for each grayscale pixel value - ignored on input\&.
.IP "\(bu" 2
4 Original field type - currently ignored on input, set = 0 on output\&. Data values assumed to be reals\&. 
.PP
.br
\fIcpack\fP The packed data field\&. 
.br
\fIlcpack\fP length of packed field cpack\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.IP "\(bu" 2
\fBG2C_EPNG\fP Error encoding/decoding PNG data\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP

.PP
Definition at line \fB294\fP of file \fBpngpack\&.c\fP\&.
.PP
References \fBG2C_PNG_DRS_TEMPLATE_LEN\fP, and \fBpngpack_int()\fP\&.
.SS "void pngpack (float * fld, \fBg2int\fP width, \fBg2int\fP height, \fBg2int\fP * idrstmpl, unsigned char * cpack, \fBg2int\fP * lcpack)"

.PP
This subroutine packs up a float data field into PNG image format\&. After the data field is scaled, and the reference value is subtracted out, it is treated as a grayscale image and passed to a PNG encoder\&. It also fills in GRIB2 Data Representation Template 5\&.41 or 5\&.40010 with the appropriate values\&.
.PP
\fBParameters\fP
.RS 4
\fIfld\fP Pointer to array of float that contains the data values to pack\&. 
.br
\fIwidth\fP Number of points in the x direction\&. 
.br
\fIheight\fP Number of points in the y direction\&. 
.br
\fIidrstmpl\fP Contains the array of values for Data Representation \fCTemplate 5\&.41\fP or 5\&.40010\&.
.IP "\(bu" 2
0 Reference value - ignored on input, set by pngpack routine\&.
.IP "\(bu" 2
1 Binary Scale Factor - used on input\&.
.IP "\(bu" 2
2 Decimal Scale Factor - used on input\&.
.IP "\(bu" 2
3 number of bits for each grayscale pixel value - ignored on input\&.
.IP "\(bu" 2
4 Original field type - currently ignored on input, set = 0 on output\&. Data values assumed to be reals\&. 
.PP
.br
\fIcpack\fP The packed data field\&. 
.br
\fIlcpack\fP length of packed field cpack\&.
.RE
.PP
\fBAuthor\fP
.RS 4
Stephen Gilbert 
.RE
.PP
\fBDate\fP
.RS 4
2003-08-27 
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP

.PP
Definition at line \fB254\fP of file \fBpngpack\&.c\fP\&.
.PP
References \fBpngpack_int()\fP\&.
.PP
Referenced by \fBg2_addfield()\fP\&.
.SS "static int pngpack_int (void * fld, int fld_is_double, \fBg2int\fP width, \fBg2int\fP height, \fBg2int\fP * idrstmpl, unsigned char * cpack, \fBg2int\fP * lcpack, int verbose)\fC [static]\fP"

.PP
Packs float or double data into PNG image format\&. This is called by \fBpngpack()\fP and pngpackd()\&.
.PP
After the data field is scaled, and the reference value is subtracted out, it is treated as a grayscale image and passed to a PNG encoder\&. It also fills in GRIB2 Data Representation Template 5\&.41 or 5\&.40010 with the appropriate values\&.
.PP
\fBParameters\fP
.RS 4
\fIfld\fP Pointer to array of float or double that contains the data values to pack\&. 
.br
\fIfld_is_double\fP If non-zero, then fld is double, otherwise float\&. 
.br
\fIwidth\fP Number of points in the x direction\&. This is passed to the PNG layer as a uint32\&. 
.br
\fIheight\fP Number of points in the y direction\&. This is passed to the PNG layer as a uint32\&. 
.br
\fIidrstmpl\fP Contains the array of values for Data Representation \fCTemplate 5\&.41\fP or 5\&.40010\&.
.IP "\(bu" 2
0 Reference value - ignored on input, set by pngpack routine\&.
.IP "\(bu" 2
1 Binary Scale Factor - used on input\&.
.IP "\(bu" 2
2 Decimal Scale Factor - used on input\&.
.IP "\(bu" 2
3 number of bits for each grayscale pixel value - ignored on input\&.
.IP "\(bu" 2
4 Original field type - currently ignored on input, set = 0 on output\&. Data values assumed to be reals\&. 
.PP
.br
\fIcpack\fP The packed data field\&. 
.br
\fIlcpack\fP length of packed field cpack\&. 
.br
\fIverbose\fP If non-zero, error messages will be printed in case of error\&. Otherwise, error codes will be return but no error messages printed\&. Calls to the original g2c API may cause error messages to be printed in case of error\&. For the new g2c_ API, no error messages will be printed - instead an error code will be returned\&. Call \fBg2c_strerror()\fP to get the error message for any error code\&.
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
\fBG2C_NOERROR\fP No error\&.
.IP "\(bu" 2
\fBG2C_EPNG\fP Error encoding/decoding PNG data\&.
.PP
.RE
.PP
\fBAuthor\fP
.RS 4
Ed Hartnett 
.RE
.PP
\fBDate\fP
.RS 4
Aug 8, 2022 
.RE
.PP

.PP
Definition at line \fB53\fP of file \fBpngpack\&.c\fP\&.
.PP
References \fBALOG2\fP, \fBenc_png()\fP, \fBG2C_EPNG\fP, \fBG2C_NOERROR\fP, \fBint_power()\fP, \fBLOG\fP, \fBmkieee()\fP, and \fBsbits()\fP\&.
.PP
Referenced by \fBg2c_pngpackd()\fP, \fBg2c_pngpackf()\fP, and \fBpngpack()\fP\&.
.SH "Author"
.PP 
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code\&.
