pngpack.c(3)
π pngpack.c(3) β Library Functions Manual π
okay bestie, gather round, because today we're talking about pngpack.c from the NCEPLIBS-g2c family, and honestly? it's giving compression icon. she packs data with PNG compression and she does it with main character energy. let's go. β¨
πΈ NAME πΈ
pngpack.c β Pack data with PNG compression. that's it, that's the whole vibe. short, sweet, slays. π
β¨ SYNOPSIS β¨
first things first, the incantations. you gotta summon these headers or nothing works, no cap:
#include 'grib2_int.h'
#include <math.h>
#include <stdlib.h>
π¦ Functions
here's the whole squad. four functions, all of them absolute legends:
int g2c_pngpackd (double *fld, size_t width, size_t height, int *idrstmpl, unsigned char *cpack, int *lcpack)β This subroutine packs up a double data field into PNG image format. (double girlies, this one's for you π«Ά)int g2c_pngpackf (float *fld, size_t width, size_t height, int *idrstmpl, unsigned char *cpack, int *lcpack)β This subroutine packs up a float data field into PNG image format. (float girlies, same energy)void pngpack (float *fld, g2int width, g2int height, g2int *idrstmpl, unsigned char *cpack, g2int *lcpack)β This subroutine packs up a float data field into PNG image format. (the OG, the classic, the moment)static int pngpack_int (void *fld, int fld_is_double, g2int width, g2int height, g2int *idrstmpl, unsigned char *cpack, g2int *lcpack, int verbose)β Packs float or double data into PNG image format. (the one doing all the actual work behind the scenes, lowkey the backbone of the friend group)
π Detailed Description π
Pack data with PNG compression.
that's the whole thesis statement bestie. data goes in, PNG compression happens, iconic behavior ensues.
Author Stephen Gilbert
Date 2003-08-27
Definition in file pngpack.c.
π Function Documentation π
π int g2c_pngpackd (double * fld, size_t width, size_t height, int * idrstmpl, unsigned char * cpack, int * lcpack)
This subroutine packs up a double data field into PNG image format. okay so here's the tea: 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. like, she does it ALL. π
Parameters
fldβ Pointer to array ofdoublethat 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.0Reference value β ignored on input, set bypngpackroutine.1Binary Scale Factor β used on input.2Decimal Scale Factor β used on input.3number of bits for each grayscale pixel value β ignored on input.4Original 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 fieldcpack.
Returns
G2C_NOERRORβ No error. πG2C_EPNGβ Error encoding/decoding PNG data. π
Author Ed Hartnett
Date Aug 8, 2022
Definition at line 348 of file pngpack.c.
References G2C_PNG_DRS_TEMPLATE_LEN, and pngpack_int().
π int g2c_pngpackf (float * fld, size_t width, size_t height, int * idrstmpl, unsigned char * cpack, int * lcpack)
This subroutine packs up a float data field into PNG image format. same storyline, float edition: 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. obsessed fr fr.
Parameters
fldβ Pointer to array offloatthat 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.0Reference value β ignored on input, set bypngpackroutine.1Binary Scale Factor β used on input.2Decimal Scale Factor β used on input.3number of bits for each grayscale pixel value β ignored on input.4Original 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 fieldcpack.
Returns
G2C_NOERRORβ No error. πG2C_EPNGβ Error encoding/decoding PNG data. π
Author Ed Hartnett
Definition at line 294 of file pngpack.c.
References G2C_PNG_DRS_TEMPLATE_LEN, and pngpack_int().
π void pngpack (float * fld, g2int width, g2int height, g2int * idrstmpl, unsigned char * cpack, g2int * lcpack)
This subroutine packs up a float data field into PNG image format. the classic!! 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. she's been doing this since 2003 and she's still that girl. π
Parameters
fldβ Pointer to array offloatthat 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.0Reference value β ignored on input, set bypngpackroutine.1Binary Scale Factor β used on input.2Decimal Scale Factor β used on input.3number of bits for each grayscale pixel value β ignored on input.4Original 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 fieldcpack.
Author Stephen Gilbert
Date 2003-08-27
Author Ed Hartnett
Definition at line 254 of file pngpack.c.
References pngpack_int().
Referenced by g2_addfield().
π§ int pngpack_int (void * fld, int fld_is_double, g2int width, g2int height, g2int * idrstmpl, unsigned char * cpack, g2int * lcpack, int verbose)
[static]
Packs float or double data into PNG image format. this is called by pngpack() and pngpackd(). she's the intern that's actually running the whole company, iykyk. π«Ά
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β Pointer to array offloatordoublethat contains the data values to pack.fld_is_doubleβ If non-zero, thenfldisdouble, otherwisefloat.widthβ Number of points in the x direction. This is passed to the PNG layer as auint32.heightβ Number of points in the y direction. This is passed to the PNG layer as auint32.idrstmplβ Contains the array of values for Data Representation Template 5.41 or 5.40010.0Reference value β ignored on input, set bypngpackroutine.1Binary Scale Factor β used on input.2Decimal Scale Factor β used on input.3number of bits for each grayscale pixel value β ignored on input.4Original 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 fieldcpack.verboseβ 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 originalg2cAPI may cause error messages to be printed in case of error. For the newg2c_API, no error messages will be printed β instead an error code will be returned. Callg2c_strerror()to get the error message for any error code.
Returns
G2C_NOERRORβ No error. πG2C_EPNGβ Error encoding/decoding PNG data. π
Author Ed Hartnett
Date Aug 8, 2022
Definition at line 53 of file pngpack.c.
References ALOG2, enc_png(), G2C_EPNG, G2C_NOERROR, int_power(), LOG, mkieee(), and sbits().
Referenced by g2c_pngpackd(), g2c_pngpackf(), and pngpack().
π Author π
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code. (yes bestie, a robot wrote the docs, but the vibes? those are all mine. π)
okay and that's the whole page!! no notes, ate and left no crumbs, periodt. π
NCEPLIBS-g2c, Version 2.3.0, and our girl pngpack.c(3) β mwah, love that for us. go forth and pack some PNGs, bestie, you've got this. π
β¨π¦πΈπ
π¦ where this page comes from
- ubuntu resolute: libg2c-dev 2.3.0-4 Β· LGPL-3.0-only
- ubuntu stonking: libg2c-dev 2.3.0-7 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms