diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-09-29 02:44:42 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-09-29 02:44:42 +0000 |
commit | acf1c3cd5f989ff0e2a3895f35875c918b4c3eb8 (patch) | |
tree | eec649bf9126f527b3b1f5bb128121e8280a49cc /converter/other | |
parent | 84c6e11810783388e5be22ab80a5dafe523f20db (diff) | |
download | netpbm-mirror-acf1c3cd5f989ff0e2a3895f35875c918b4c3eb8.tar.gz netpbm-mirror-acf1c3cd5f989ff0e2a3895f35875c918b4c3eb8.tar.xz netpbm-mirror-acf1c3cd5f989ff0e2a3895f35875c918b4c3eb8.zip |
Release 10.47.70
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3345 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rw-r--r-- | converter/other/pstopnm.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/converter/other/pstopnm.c b/converter/other/pstopnm.c index ba1470b0..0e91ad9c 100644 --- a/converter/other/pstopnm.c +++ b/converter/other/pstopnm.c @@ -275,9 +275,13 @@ computeSizeResBlind(unsigned int const xmax, unsigned int * const xresP, unsigned int * const yresP) { - *xresP = *yresP = MIN(xmax * 72 / imageWidth, - ymax * 72 / imageHeight); - + if (imageWidth == 0 || imageHeight == 0) { + *xresP = *yresP = 72; + } else { + *xresP = *yresP = MIN(xmax * 72 / imageWidth, + ymax * 72 / imageHeight); + } + if (nocrop) { *xsizeP = xmax; *ysizeP = ymax; @@ -335,10 +339,13 @@ computeSizeRes(struct cmdlineInfo const cmdline, *xresP = *yresP = cmdline.dpi; *xsizeP = (int) (cmdline.dpi * sx / 72 + 0.5); *ysizeP = (int) (cmdline.dpi * sy / 72 + 0.5); - } else if (cmdline.xsize || cmdline.ysize) + } else if (cmdline.xsize || cmdline.ysize) { + if (sx == 0 || sy == 0) + pm_error("Input image is zero size; we cannot satisfy your " + "produce your requested output dimensions"); computeSizeResFromSizeSpec(cmdline.xsize, cmdline.ysize, sx, sy, xsizeP, ysizeP, xresP, yresP); - else + } else computeSizeResBlind(cmdline.xmax, cmdline.ymax, sx, sy, cmdline.nocrop, xsizeP, ysizeP, xresP, yresP); @@ -886,7 +893,12 @@ main(int argc, char ** argv) { computeSizeRes(cmdline, orientation, bordered_box, &xsize, &ysize, &xres, &yres); - + + if (xres == 0) + xres = 1; + if (yres == 0) + yres = 1; + pstrans = computePstrans(bordered_box, orientation, xsize, ysize, xres, yres); |