
Thread
2012.09.03 15:25 "[Tiff] Help Reading TIFF", by Steve Miller
// TIFF.cpp: Defines the entry point for the console application.
//
#include "stdafx.h"
#include"t4.h"
#include "tiff.h"
#include "tiffconf.h"
#include "tiffconf.vc.h"
#include "tiffio.h"
#include "tiffiop.h"
#include "tiffvers.h"
#include "tif_config.h"
#include "tif_config.vc.h"
#include "tif_dir.h"
#include "tif_fax3.h"
#include "tif_predict.h"
#include "uvcode.h"
#pragma comment(lib, "libtiff")
int _tmain(int argc, _TCHAR* argv[])
{
TIFF *fpTIFFImage;
unsigned int height;
unsigned int width;
unsigned int BitsPerSample;
unsigned int *Image = 0;
unsigned int *stopOnError= 0;
if(fpTIFFImage = TIFFOpen("C:\\Users\\Steve\\Gettysburg020512\\39077g25.tif", "r"))
{
//height = TIFFGetField(fpTIFFImage, TIFFTAG_IMAGELENGTH);
//width = TIFFGetField(fpTIFFImage, TIFFTAG_IMAGEWIDTH);
height = 5529;
width = 7079;
BitsPerSample = TIFFGetField(fpTIFFImage,
TIFFTAG_BITSPERSAMPLE);
*Image = (unsigned
int)_TIFFmalloc(height*width*BitsPerSample*sizeof(unsigned int));
TIFFReadRGBAImage(fpTIFFImage, width, height, Image, 0);
}
return 0;
}
I am having trouble getting the TIFFGetField results I think I should. It
is returning a 1 and I know from ASTIFFTAG Viewer I should be getting height
of 5529 and length of 7079.
Any help would be appreciated.
Steve