2005.09.19 02:47 "[Tiff] How can I remove the last white lines?", by Flávio Tiba
Hello,
I am a new user of libtiff library and I have some doubts. I am developing a program to read a tiff file G3 and I need to clear the last white lines from file, I would like to know what api can I use?
my code:
TIFF *image;
tsize_t stripSize;
unsigned long imageOffset,result;
int stripMax,stripCount;
char *buffer;
unsigned long bufferSize;
uint32 rowsperstrip;
int count;
uint32 width;
// Abre a imagem TIFF.
if((image = TIFFOpen(pathArquivo, "r")) == NULL)
{
fprintf(stderr, "Could not open incoming image\n");
return FALSE;
}
// Lê a possibilidade de multiplos strips.
if((stripSize = TIFFStripSize (image)) == -1)
{
return FALSE;
}
if((stripMax = TIFFNumberOfStrips (image)) == -1)
{
return FALSE;
}
bufferSize = TIFFNumberOfStrips (image) * stripSize;
if((buffer = (char *) malloc(bufferSize)) == NULL)
{
fprintf(stderr, "Could not allocate enough memory for the uncompressed image\n");
return FALSE;
}
imageOffset = 0;
for (stripCount = 0; stripCount < stripMax; stripCount++)
{
if((result = TIFFReadEncodedStrip (image, stripCount, buffer + imageOffset,stripSize)) == -1)
{
fprintf(stderr, "Read error on input strip number %d\n", stripCount);
return FALSE;
}
imageOffset += result;
}