2008.03.27 17:43 "[Tiff] Open Tiff File in Read and write mode.", by Jean-Michel FRECINAT
Hi,
I use libtiff 3.8.2 and i have some problems with memory. When I create a 30000x10000 pixels in cmyk, i have to have a lot of RAM memory (about 2-3GB).
To create this file, I use this code.
unsigned char* raster = (unsigned char*)_TIFFmalloc(width*height*spp);
but this method require a lot of memory.
I want use this code.
unsigned char* raster = (unsigned char*)_TIFFmalloc(width*spp);
But my problem, i would open my file in read and write mode to edit and to process some pixels and after save the scanline into file.
Like that:
for(unsigned long y=0 ; y<height ; y++)
{
TIFFReadScanline(input,data,y,0);
TIFFReadScanline(output,raster,y,0);
for(unsigned long x=0 ; x< width ; x++)
{
for(unsigned short sample = 0 ; sample < spp ; sample++)
{
raster[(width*index+x)*spp+sample] = data[x*spp+sample];
...
}
}
TIFFWriteScanline(output,raster,y,0);
...
This method could help me to create large tiff files with only 1GB of RAM memory.
It is possible, can you help me.
best regards.
_________________________________________________________________
Découvrez les profils Messenger de vos amis!
http://home.services.spaces.live.com/