about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-06-27 02:05:18 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-06-27 02:05:18 +0000
commit3bbf7f47724bc05c32cd9d4b53425765dfe711ed (patch)
tree107fc54f21584c1d225d946d60850ff195daa611
parentbcfb7ea3c80a10cc948e0e82c801fa9365835e34 (diff)
downloadnetpbm-mirror-3bbf7f47724bc05c32cd9d4b53425765dfe711ed.tar.gz
netpbm-mirror-3bbf7f47724bc05c32cd9d4b53425765dfe711ed.tar.xz
netpbm-mirror-3bbf7f47724bc05c32cd9d4b53425765dfe711ed.zip
Release 10.73.20
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3269 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/pngtopam.c5
-rw-r--r--converter/other/pngx.c28
-rw-r--r--converter/other/pngx.h6
-rw-r--r--doc/HISTORY6
-rw-r--r--version.mk2
5 files changed, 41 insertions, 6 deletions
diff --git a/converter/other/pngtopam.c b/converter/other/pngtopam.c
index 59b29f5f..8743174e 100644
--- a/converter/other/pngtopam.c
+++ b/converter/other/pngtopam.c
@@ -1238,9 +1238,8 @@ static void
 warnNonsquarePixels(struct pngx * const pngxP,
                     int *         const errorLevelP) {
 
-    if (pngx_chunkIsPresent(pngxP, PNG_INFO_pHYs)) {
-        float const r =
-            (float)pngx_xPixelsPerMeter(pngxP) / pngx_yPixelsPerMeter(pngxP);
+    if (pngx_pixelAspectRatioIsKnown(pngxP)) {
+        float const r = pngx_pixelAspectRatio(pngxP);
 
         if (r != 1.0) {
             const char * const baseMsg = "warning - non-square pixels";
diff --git a/converter/other/pngx.c b/converter/other/pngx.c
index a5171066..185b4a27 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);
 }
 
diff --git a/converter/other/pngx.h b/converter/other/pngx.h
index cabb0663..81e0dc55 100644
--- a/converter/other/pngx.h
+++ b/converter/other/pngx.h
@@ -112,6 +112,12 @@ pngx_xPixelsPerMeter(struct pngx * const pngxP);
 uint32_t
 pngx_yPixelsPerMeter(struct pngx * const pngxP);
 
+float
+pngx_pixelAspectRatio(struct pngx * const pngxP);
+
+bool
+pngx_pixelAspectRatioIsKnown(struct pngx * const pngxP);
+
 void
 pngx_removeChunk(struct pngx * const pngxP,
                  uint32_t      const chunkType);
diff --git a/doc/HISTORY b/doc/HISTORY
index a83c5bf1..87f815b8 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,12 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+18.06.27 BJH  Release 10.73.20
+
+              Pngtopam: Fix bogus warning of non-square pixels when image does
+              not contain pixel resolution information.  Introduced in Netpbm
+              10.48 (September 2009)
+
 18.04.28 BJH  Release 10.73.19
 
               ilbmtoppm: Fix bug: may fail with bogus error message about an
diff --git a/version.mk b/version.mk
index a0168fc6..d43b963a 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 73
-NETPBM_POINT_RELEASE = 19
+NETPBM_POINT_RELEASE = 20