|TIFF and LibTiff Mail List Archive|
LibTiff Mailing List
2006.09.27 04:21 "[Tiff] YCbCr data in tiffcrop", by Richard Nolde
Joris / Bob/list,
The routines that I am using for reading and writing the data are exactly those used in tiffcp now and they handle strips and tiles in contiguous and separate planar configurations. I found no indication that they made any distinctions based on the color model or compression since they call low level libtiff routines to handle the codecs. They are documented as delivering the uncompressed data to the specified buffer in scanlines or tiles as requested. I deduced by experiment, that this buffer is always arranged as plannar config contiguous for all the sample formats that I have been able to handle correctly. I surmise that YCbCr data comes in differently because the resulting image is shifted half an image width and badly color shifted but vaguely recognizable when I try to mirror it horizontally. When mirrored vertically, it gets chopped up into 4 quadrants with a stripe in the center. Based on the explanation of YCbCr, which is admittedly over my head, my simple copying and/or chopping of portions of the image based on bits per sample and samples per pixel is probably not going to work here unless I can reorder the data in the read buffer to resemble a multi-byte per pixel sample with a known number of bytes to grab for each pixel. RGBA works fine, but the sequence described by Joris doesn't look too promising for pointer offset slicing and dicing. I don't need YCbCr for my project but I wanted to try to support all the options that tiffcp does since tiffcrop is a superset of tiffcp. Given an infinite amount of time, I would like to add more functions like multi-page splitting capabilities found in tiff2ps so that one image can be spread over multiple output images. Tiff2ps relies on the Postscript mask operator to do this but it is very inefficient storage wise as it keeps a copy of the entire image for each page and just masks off different regions each time. My code from tiffcrop could be ported to tiff2ps to store only the cropped portion in each image.
> > organisation, and a convertion needs to be made...