diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-06-27 01:58:45 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-06-27 01:58:45 +0000 |
commit | 8a9e82c734ac5da06c6d7347a33e505ce1aa26ec (patch) | |
tree | e0f33b03566bf6c2ba8a46a377a434094014973a /converter/other/pngx.c | |
parent | 67f4338ccd643cb39a3f50ec6910cab5fce14a3e (diff) | |
download | netpbm-mirror-8a9e82c734ac5da06c6d7347a33e505ce1aa26ec.tar.gz netpbm-mirror-8a9e82c734ac5da06c6d7347a33e505ce1aa26ec.tar.xz netpbm-mirror-8a9e82c734ac5da06c6d7347a33e505ce1aa26ec.zip |
Fix computation of pixel aspect ratio when PNG does not contain resolution information
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3266 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pngx.c')
-rw-r--r-- | converter/other/pngx.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/converter/other/pngx.c b/converter/other/pngx.c index 06b8a513..dfc74485 100644 --- a/converter/other/pngx.c +++ b/converter/other/pngx.c @@ -270,15 +270,39 @@ pngx_trns(struct pngx * const pngxP) { uint32_t pngx_xPixelsPerMeter(struct pngx * const pngxP) { - +/*---------------------------------------------------------------------------- + Horizontal pixel density in pixel per meter; 0 if unknown. +-----------------------------------------------------------------------------*/ return png_get_x_pixels_per_meter(pngxP->png_ptr, pngxP->info_ptr); } +float +pngx_pixelAspectRatio(struct pngx * const pngxP) { +/*---------------------------------------------------------------------------- + Aspect ratio - y/x. 0.0 if unknown +-----------------------------------------------------------------------------*/ + return png_get_pixel_aspect_ratio(pngxP->png_ptr, pngxP->info_ptr); +} + + + +bool +pngx_pixelAspectRatioIsKnown(struct pngx * const pngxP) { +/*---------------------------------------------------------------------------- + There is pixel aspect ratio information in the PNG image. +-----------------------------------------------------------------------------*/ + return png_get_pixel_aspect_ratio(pngxP->png_ptr, pngxP->info_ptr) != 0.0; +} + + + uint32_t pngx_yPixelsPerMeter(struct pngx * const pngxP) { - +/*---------------------------------------------------------------------------- + Vertical pixel density in pixel per meter; 0 if unknown. +-----------------------------------------------------------------------------*/ return png_get_y_pixels_per_meter(pngxP->png_ptr, pngxP->info_ptr); } |