Scroll to navigation

pngpack.c(3) NCEPLIBS-g2c pngpack.c(3)

NAME

pngpack.c

SYNOPSIS

#include <stdlib.h>
#include <math.h>
#include 'grib2.h'

Functions


int enc_png (char *, g2int, g2int, g2int, char *)
Encode PNG. void pngpack (g2float *fld, g2int width, g2int height, g2int *idrstmpl, unsigned char *cpack, g2int *lcpack)
This subroutine packs up a data field into PNG image format.

Detailed Description

Author

Stephen Gilbert

Date

2003-08-27

Definition in file pngpack.c.

Function Documentation

int enc_png (char * data, g2int width, g2int height, g2int nbits, char * pngbuf)

Encode PNG.

Parameters

data data.
width width.
height height.
nbits number of bits.
pngbuf PNG buffer.

Returns

PNG length, or negative number for error.

Author

Stephen Gilbert

Definition at line 81 of file enc_png.c.

References user_flush_data(), and user_write_data().

Referenced by pngpack().

void pngpack (g2float * fld, g2int width, g2int height, g2int * idrstmpl, unsigned char * cpack, g2int * lcpack)

This subroutine packs up a 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.

Parameters

fld Contains the data values to pack.
width number of points in the x direction.
height number of points in the y direction.
idrstmpl Contains the array of values for Data Representation Template 5.41 or 5.40010.
  • 0 Reference value - ignored on input, set by pngpack routine.
  • 1 Binary Scale Factor - used on input.
  • 2 Decimal Scale Factor - used on input.
  • 3 number of bits for each grayscale pixel value - ignored on input.
  • 4 Original field type - currently ignored on input, set = 0 on output. Data values assumed to be reals.

cpack The packed data field.
lcpack length of packed field cpack.

Author

Stephen Gilbert

Date

2003-08-27

Definition at line 34 of file pngpack.c.

References enc_png(), int_power(), mkieee(), and sbits().

Referenced by g2_addfield().

Author

Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.

Fri Jun 3 2022 Version 1.6.4