cjpeg -verbose: Print PBMPLUS input file precision
This gives the user a hint as to whether converting the input file into a JPEG file with a particular data precision will result in a loss of precision. Also modify usage.txt and the cjpeg man page to warn the user about that possibility.
This commit is contained in:
10
cderror.h
10
cderror.h
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 2009-2017 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2021, D. R. Commander.
|
||||
* Copyright (C) 2021, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -76,10 +76,10 @@ JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
|
||||
JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
|
||||
JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
|
||||
JMESSAGE(JERR_PPM_OUTOFRANGE, "Numeric value out of range in PPM file")
|
||||
JMESSAGE(JTRC_PGM, "%ux%u PGM image")
|
||||
JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
|
||||
JMESSAGE(JTRC_PPM, "%ux%u PPM image")
|
||||
JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
|
||||
JMESSAGE(JTRC_PGM, "%ux%u PGM image (maximum color value = %u)")
|
||||
JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image (maximum color value = %u)")
|
||||
JMESSAGE(JTRC_PPM, "%ux%u PPM image (maximum color value = %u)")
|
||||
JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image (maximum color value = %u)")
|
||||
|
||||
JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
|
||||
JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
|
||||
|
||||
8
cjpeg.1
8
cjpeg.1
@@ -157,7 +157,13 @@ must also be specified. Note that only the PBMPLUS input file format supports
|
||||
data precisions other than 8. (For historical reasons,
|
||||
.B cjpeg
|
||||
allows GIF input files to be converted into 12-bit-per-sample JPEG files, but
|
||||
this is not a useful conversion.)
|
||||
this is not a useful conversion.) Note also that PBMPLUS input files are
|
||||
silently scaled to the target data precision, even if it is lower than the
|
||||
precision of the input file. Passing an argument of
|
||||
.B \-verbose
|
||||
to
|
||||
.B cjpeg
|
||||
will cause it to print information about the precision of the input file.
|
||||
.B Caution:
|
||||
12-bit and 16-bit data precision is not yet widely implemented, so many
|
||||
decoders will be unable to handle a 12-bit-per-sample or 16-bit-per-sample JPEG
|
||||
|
||||
10
rdppm.c
10
rdppm.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2009 by Bill Allombert, Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2015-2017, 2020-2023, D. R. Commander.
|
||||
* Copyright (C) 2015-2017, 2020-2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -707,7 +707,7 @@ start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
if (cinfo->in_color_space == JCS_UNKNOWN ||
|
||||
cinfo->in_color_space == JCS_RGB)
|
||||
cinfo->in_color_space = JCS_GRAYSCALE;
|
||||
TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h);
|
||||
TRACEMS3(cinfo, 1, JTRC_PGM_TEXT, w, h, maxval);
|
||||
if (cinfo->in_color_space == JCS_GRAYSCALE)
|
||||
source->pub.get_pixel_rows = get_text_gray_row;
|
||||
else if (IsExtRGB(cinfo->in_color_space))
|
||||
@@ -722,7 +722,7 @@ start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
case '3': /* it's a text-format PPM file */
|
||||
if (cinfo->in_color_space == JCS_UNKNOWN)
|
||||
cinfo->in_color_space = JCS_EXT_RGB;
|
||||
TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h);
|
||||
TRACEMS3(cinfo, 1, JTRC_PPM_TEXT, w, h, maxval);
|
||||
if (IsExtRGB(cinfo->in_color_space))
|
||||
source->pub.get_pixel_rows = get_text_rgb_row;
|
||||
else if (cinfo->in_color_space == JCS_CMYK)
|
||||
@@ -736,7 +736,7 @@ start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
if (cinfo->in_color_space == JCS_UNKNOWN ||
|
||||
cinfo->in_color_space == JCS_RGB)
|
||||
cinfo->in_color_space = JCS_GRAYSCALE;
|
||||
TRACEMS2(cinfo, 1, JTRC_PGM, w, h);
|
||||
TRACEMS3(cinfo, 1, JTRC_PGM, w, h, maxval);
|
||||
if (maxval > 255) {
|
||||
if (cinfo->in_color_space == JCS_GRAYSCALE)
|
||||
source->pub.get_pixel_rows = get_word_gray_row;
|
||||
@@ -766,7 +766,7 @@ start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
case '6': /* it's a raw-format PPM file */
|
||||
if (cinfo->in_color_space == JCS_UNKNOWN)
|
||||
cinfo->in_color_space = JCS_EXT_RGB;
|
||||
TRACEMS2(cinfo, 1, JTRC_PPM, w, h);
|
||||
TRACEMS3(cinfo, 1, JTRC_PPM, w, h, maxval);
|
||||
if (maxval > 255) {
|
||||
if (IsExtRGB(cinfo->in_color_space))
|
||||
source->pub.get_pixel_rows = get_word_rgb_row;
|
||||
|
||||
13
usage.txt
13
usage.txt
@@ -171,10 +171,15 @@ Switches for advanced users:
|
||||
PBMPLUS input file format supports data precisions other
|
||||
than 8. (For historical reasons, cjpeg allows GIF input
|
||||
files to be converted into 12-bit-per-sample JPEG files,
|
||||
but this is not a useful conversion.) CAUTION: 12-bit
|
||||
and 16-bit data precision is not yet widely implemented,
|
||||
so many decoders will be unable to handle a
|
||||
12-bit-per-sample or 16-bit-per-sample JPEG file at all.
|
||||
but this is not a useful conversion.) Note also that
|
||||
PBMPLUS input files are silently scaled to the target
|
||||
data precision, even if it is lower than the precision
|
||||
of the input file. Passing an argument of -verbose to
|
||||
cjpeg will cause it to print information about the
|
||||
precision of the input file. CAUTION: 12-bit and 16-bit
|
||||
data precision is not yet widely implemented, so many
|
||||
decoders will be unable to handle a 12-bit-per-sample or
|
||||
16-bit-per-sample JPEG file at all.
|
||||
|
||||
-lossless psv[,Pt] Create a lossless JPEG file using the specified
|
||||
predictor selection value (1 - 7) and optional point
|
||||
|
||||
Reference in New Issue
Block a user