diff options
Diffstat (limited to 'converter/other')
-rwxr-xr-x | converter/other/anytopnm | 2 | ||||
-rw-r--r-- | converter/other/giftopnm.c | 35 | ||||
-rw-r--r-- | converter/other/pngtopam.c | 14 | ||||
-rw-r--r-- | converter/other/pnmtopalm/pnmtopalm.c | 6 | ||||
-rw-r--r-- | converter/other/pnmtops.c | 16 |
5 files changed, 52 insertions, 21 deletions
diff --git a/converter/other/anytopnm b/converter/other/anytopnm index acf88136..f3a00793 100755 --- a/converter/other/anytopnm +++ b/converter/other/anytopnm @@ -379,7 +379,7 @@ case "$2" in ;; gif ) - giftopnm "$file" + giftopnm -image=all "$file" ;; tiff ) diff --git a/converter/other/giftopnm.c b/converter/other/giftopnm.c index 9a543532..9f4bc8a1 100644 --- a/converter/other/giftopnm.c +++ b/converter/other/giftopnm.c @@ -1674,6 +1674,28 @@ readImageData(FILE * const ifP, static void +warnUserNotSquare(unsigned int const aspectRatio) { + + const char * baseMsg = + "warning - input pixels are not square, " + "but we are rendering them as square pixels " + "in the output"; + + if (pm_have_float_format()) { + float const r = ((float)aspectRatio + 15.0 ) / 64.0; + + pm_message("%s. To fix the output, run it through " + "'pamscale -%cscale %g'", + baseMsg, + r < 1.0 ? 'x' : 'y', + r < 1.0 ? 1.0 / r : r ); + } else + pm_message("%s", baseMsg); +} + + + +static void readGifHeader(FILE * const gifFileP, struct gifScreen * const gifScreenP) { /*---------------------------------------------------------------------------- @@ -1734,17 +1756,8 @@ readGifHeader(FILE * const gifFileP, } } - if (gifScreenP->AspectRatio != 0 && gifScreenP->AspectRatio != 49) { - float r; - r = ( (float) gifScreenP->AspectRatio + 15.0 ) / 64.0; - pm_message("warning - input pixels are not square, " - "but we are rendering them as square pixels " - "in the output. " - "To fix the output, run it through " - "'pnmscale -%cscale %g'", - r < 1.0 ? 'x' : 'y', - r < 1.0 ? 1.0 / r : r ); - } + if (gifScreenP->AspectRatio != 0 && gifScreenP->AspectRatio != 49) + warnUserNotSquare(gifScreenP->AspectRatio); } diff --git a/converter/other/pngtopam.c b/converter/other/pngtopam.c index e6e68587..59b29f5f 100644 --- a/converter/other/pngtopam.c +++ b/converter/other/pngtopam.c @@ -1243,10 +1243,16 @@ warnNonsquarePixels(struct pngx * const pngxP, (float)pngx_xPixelsPerMeter(pngxP) / pngx_yPixelsPerMeter(pngxP); if (r != 1.0) { - pm_message ("warning - non-square pixels; " - "to fix do a 'pamscale -%cscale %g'", - r < 1.0 ? 'x' : 'y', - r < 1.0 ? 1.0 / r : r ); + const char * const baseMsg = "warning - non-square pixels"; + + if (pm_have_float_format()) + pm_message("%s; to fix do a 'pamscale -%cscale %g'", + baseMsg, + r < 1.0 ? 'x' : 'y', + r < 1.0 ? 1.0 / r : r); + else + pm_message("%s", baseMsg); + *errorLevelP = PNMTOPNG_WARNING_LEVEL; } } diff --git a/converter/other/pnmtopalm/pnmtopalm.c b/converter/other/pnmtopalm/pnmtopalm.c index 67a17e54..7740a3ac 100644 --- a/converter/other/pnmtopalm/pnmtopalm.c +++ b/converter/other/pnmtopalm/pnmtopalm.c @@ -33,8 +33,8 @@ struct cmdline_info { /* All the information the user supplied in the command line, in a form easy for the program to use. */ - const char *inputFilespec; /* Filespecs of input files */ - char *transparent; /* -transparent value. Null if unspec */ + const char * inputFilespec; /* Filespecs of input files */ + const char * transparent; /* -transparent value. Null if unspec */ unsigned int depth; /* -depth value. 0 if unspec */ unsigned int maxdepth; /* -maxdepth value. 0 if unspec */ enum compressionType compression; @@ -289,7 +289,7 @@ formatName(int const format) { static void -findTransparentColor(char * const colorSpec, +findTransparentColor(const char * const colorSpec, pixval const newMaxval, bool const directColor, pixval const maxval, diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c index 316b7626..cf6b2873 100644 --- a/converter/other/pnmtops.c +++ b/converter/other/pnmtops.c @@ -1125,6 +1125,19 @@ validateComputableBoundingBox(float const scols, static void +warnUserRescaling(float const scale) { + + const char * const baseMsg = "warning, image too large for page"; + + if (pm_have_float_format()) + pm_message("%s; rescaling to %g", baseMsg, scale); + else + pm_message("%s; rescaling", baseMsg); +} + + + +static void computeImagePosition(int const dpiX, int const dpiY, int const icols, @@ -1231,8 +1244,7 @@ computeImagePosition(int const dpiX, *srowsP = scale * rows * pixfacY; if (scale != requestedScale) - pm_message("warning, image too large for page, rescaling to %g", - scale ); + warnUserRescaling(scale); /* Before May 2001, Pnmtops enforced a 5% margin around the page. If the image would be too big to leave a 5% margin, Pnmtops would |