
Thread
2009.08.15 03:45 "[Tiff] scanline size and image width", by Dave Sun
Question shor version:
why scanlinesize is 1024 while my image width is 512?
Long version of the question is following:
I have 16 bit gray image, 512x512,
when I checked
linesize = TIFFScanlineSize(image);
it gives me 1024;
to read in the image, I used following
buffer = (char*)_TIFFmalloc(linesize*height);
for(int i=0; i< height; i++)
TIFFReadScanline(image, &buffer[i*linesize], i);
It works well.
Now I want to get the pixel values and found that
for(int i=0; i < 512*512; i++){
//cout << i << "\t" << ((uint16 *)buffer)[i] << endl;
imageList.push_back(((uint16 *)buffer)[i]);
}
works. Note 512*512 (image width * image height, but not 1024*512, scanlinesize*image height).
My question is why scanlinesize is twice bigger as the image width?
Thank you.
Any suggestion is welcome.