Hi I am using the dev c++ compiler can somebody please guide me as tohow I should integrate libtiff and its associated header files with the c++ compiler .I am on a deadline so any help would be greatly appreciated.
Can somebody also be kind enough to run this code as to see if its working as I am not able to integrate libtiff to my compiler.
the code is supposed to read in two images or more and composite them ..
Thanks
#include <stdio.h>
#include <tiffio.h> // Includes the TIFF APIs Declarations
int main(int argc,char * argv[])
{
TIFF *tif_in,*tif_out; // Tiff file pointers creation
int i,s;
unsigned int imagelength,row,samples;
tdata_t buf;
if ( argc < 4 )
{
printf("USAGE program file1 file2...[fileN] outputfile\n");
return 0;
}
// Opening output file in append mode will help to append to the previous runs.
tif_out=TIFFOpen(argv[argc-1],"a");
if ( tif_out==NULL )
{
printf("unable to open file %s \n",argv[argc-1]);
return 0;
}
// Looping for all input files
for ( i= 1;i < argc-1;i++ )
{
tif_in=TIFFOpen(argv[i],"r");
if ( tif_in != NULL )
{
TIFFGetField(tif_in,TIFFTAG_IMAGELENGTH,&imagelength);
TIFFGetField(tif_in,TIFFTAG_SAMPLESPERPIXEL,&samples);
buf = _TIFFmalloc(TIFFScanlineSize(tif_in));
for ( s=0;s<samples;s++ )
{
for ( row =0;row<imagelength;row++ )
{
TIFFReadScanline(tif_in,buf,row,s);
TIFFWriteScanline(tif_out,buf,row+i,s+i);
}
}
_TIFFfree(buf);
TIFFClose(tif_in);
}
else
{
printf("unable to open file %s \n",argv[i]);
TIFFClose(tif_in);
TIFFClose(tif_out);
return 0;
}
}
TIFFClose(tif_out);
return 1;
}
<< moderator edit: added [code][/code] tags and indenting >>