2006.02.20 07:54 "[Tiff] TIFFReadScanline query", by Benares

2006.02.21 03:50 "Re: [Tiff] TIFFReadScanline query", by Benares

Hi Chris, thanks for your reply to my newbish query!

I'm pretty sure the tiff file that I was trying to parse is the actual file and not the thumbnail file, since the thumbnail file is of a much smaller resolution as compared to the actual file. In addition, my output file using the snipplet of codes I've quoted in my previous entry, had almost the same dimension as the original, just that this output.tif appears to be in columns of pure Red, Green, Blue, Black and this pattern repeats till the end of the image width.

As for the RAW file format, I'm not too sure about it. How'd you categorise/deduce that the camera saves the file in RAW format? Since, after playing with the camera's interface and reading on its output format types off the net, I'm not sure if uncompressed tiff file format equals to RAW. Could anybody enlighten me on this?

Do refer to the URLs below to get a clearer picture of what I meant, as they say, a picture speaks a million words. I'm really sorry for not being able to phrase my question properly. Nonetheless, thanks a lot again for all the assistance!

http://home.pacific.net.sg/~benares/ben_sample.tif <- before

http://home.pacific.net.sg/~benares/output.tif <- after (p/s: maximise your browser if you've difficulty viewing the picture off the website.)

Rgds,
benares

On 2/21/06, Chris Cox <ccox@adobe.com> wrote:

>

> That sounds like you're getting the thumbnail image and not the full size > image.

> Are you sure this camera isn't saving a RAW file and you're just reading > the RGB thumbnail?

>
> Chris
>
>
>

> On 2/19/06 11:54 PM, "Benares" <benarestham@gmail.com> wrote:

I've some difficulty parsing the tiff image information into a raster array to hold these values, processing the raster data then write the resulting data into another tiff image. I've tried using the TIFFReadScanline function to parse these data, however my image would not appear as the original. I'm wondering where actually went wrong. Could anybody help advise?

My tiff file is extracted from a Kodak digital camera model DC290. The default file information are as follows.

IMAGEWIDTH: 720
IMAGEHEIGHT: 480
SAMPLESPERPIXEL: 3
ROWSPERSTRIP: 3
BITSPERSAMPLE: 8
PLANARCONFIG: 1 (Chunky)
ORIENTATION: 1 (Top-Left)
PHOTOMETRIC: 2 (RGB)

====================Reading in the image information into pic_buffer================

    int j, k, row_counter, offset;

    tsize_t ScanlineSize = TIFFScanlineSize(tiffRead);         //ScanlineSize

= 2160 = 720*3

    uint32* pic_buffer = (uint32*)_TIFFmalloc(sizeof(uint32) * imageWidth  *

imageHeight);
    uint32* line_buffer = (uint32*)_TIFFmalloc(sizeof(uint32) *
ScanlineSize);

    k=0;
    for (row_counter=0; row_counter<imageHeight; row_counter++)
    {
        TIFFReadScanline(tiffRead, line_buffer, row_counter);
        for( j=0; j<ScanlineSize; j+=3 ) //reading RGB value from
file and combining into pixel[k]
        {
            pic_buffer[k] = ( ((((uint32)line_buffer[j]) <<8<<8
)&0x00FF0000)

                            | ((((uint32)line_buffer[j+1]) <<8 )&0x0000FF00)
                            | (((uint32)line_buffer[j+2])&0x000000FF) );

            k++;
        }
    }

====================Reading in the image information into pic_buffer================

=====================Writing the image information into output.tif=================

    for (row_counter=0; row_counter<imageHeight; row_counter++)
    {
        k=0;
        offset = row_counter*imageWidth;
        for (j=0; j<imageWidth; j++)
        {
            line_buffer[k] =
(uint32)((pic_buffer[j+offset]&0x00FF0000)>>8>>8); //Red content