AWARE [SYSTEMS]
AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
January 2019

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
Archive maintained by AWare Systems



New Datamatrix section



Valid HTML 4.01!



Thread

2019.01.13 21:11 "Re: Tiff Digest, Vol 3, Issue 5", by Richard Nolde
2019.01.13 23:12 "Re: tiffcp altering image contents (in contrast to what the manual says)?", by <lists@binarus.de>
2019.01.14 17:44 "Re: tiffcp altering image contents (in contrast to what the manual says)?", by Daniel Mccoy
2019.01.14 17:45 "Re: tiffcp altering image contents (in contrast to what the manual says)?", by Daniel Mccoy
2019.01.15 08:20 "Re: tiffcp altering image contents (in contrast to what the manual says)?", by <lists@binarus.de>
2019.01.15 08:18 "Re: tiffcp altering image contents (in contrast to what the manual says)?", by <lists@binarus.de>

2019.01.13 21:11 "Re: Tiff Digest, Vol 3, Issue 5", by Richard Nolde

Bob is certainly correct in stating that the issue is that the output is
written using YCBCR encoding. It is possible that your viewer is not
displaying this correctly. Why not simply use another compression
algorithm and why use Graphics Magick at all if you are just compression
and combining them? Tiffcp or tiffcrop can compress an uncompressed file
on the fly while making a multi-page TIFF from a series of uncompressed
single page TIFF files. If your files have various bit depths for which
the same compression algorithm cannot be used, you would have to first
combine all of them at a given bit depth and specify a compression
algorithm that is appropriate for that bit depth. After the subsets are
combined, ie, all the 1 bit bilevel images with CITT Group3 or Group4
encoding, all the RGB images with Zip or LZW or ZIP, you call tiffcp
with no compression algorithm specified to build the final version.

If, as I suspect, you want them in a specific order, you run tiffcp once
on each file (or group of files with the same bit depth) to do the
compression and then once on the entire list of compressed files without
modifying the compression.

Your script can run tiffinfo over each file and grep for the word
Sample. Based on the result, you can set the compression used in the
subsequent call to tiffcp in the first pass which writes out a temporary
file X.tmp.tif into a separate directory. Once all the files have been
compressed into the temporary directory, you call tiffcp again on the
temporary files and write the multi-page result file wherever you like.

 tiffinfo CalTopoCycleMapSettings.tif
TIFF Directory at offset 0x1ad4e (109902)
  Subfile Type: (0 = 0x0)
  Image Width: 365 Image Length: 762
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 8
  Compression Scheme: AdobeDeflate
  Photometric Interpretation: RGB color
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Rows/Strip: 64
  Planar Configuration: single image plane
  DocumentName: /home/nolde/CalTopoCycleMapSettings.tif
  Predictor: horizontal differencing 2 (0x2)

Richard Nolde

The excerpt below comes from the tiffcp.c source code.

       if (input_compression == COMPRESSION_JPEG) {
                /* Force conversion to RGB */
                TIFFSetField(in, TIFFTAG_JPEGCOLORMODE,
JPEGCOLORMODE_RGB);
        } else if (input_photometric == PHOTOMETRIC_YCBCR) {
                /* Otherwise, can't handle subsampled input
*/
                uint16 subsamplinghor,subsamplingver;

                TIFFGetFieldDefaulted(in,
TIFFTAG_YCBCRSUBSAMPLING,
                                     
&subsamplinghor, &subsamplingver);
                if (subsamplinghor!=1 || subsamplingver!=1) {
                        fprintf(stderr, "tiffcp: %s:
Can't copy/convert
subsampled image.\n",
                               
TIFFFileName(in));
                        return FALSE;
                }
        }
        if (compression == COMPRESSION_JPEG) {
                if (input_photometric == PHOTOMETRIC_RGB &&
                    jpegcolormode == JPEGCOLORMODE_RGB)
                  TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_YCBCR);
                else
                  TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
input_photometric);
        }
        else if (compression == COMPRESSION_SGILOG
            || compression == COMPRESSION_SGILOG24)
                TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
                    samplesperpixel == 1 ?
                    PHOTOMETRIC_LOGL :
PHOTOMETRIC_LOGLUV);
        else if (input_compression == COMPRESSION_JPEG &&
                         samplesperpixel == 3 ) {
                /* RGB conversion was forced above
                hence the output will be of the same type */
                TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_RGB);
        }


_______________________________________________
Tiff mailing list
Tiff@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/tiff