2015.08.17 05:49 "[Tiff] hi i need you help", by 이강훈

2015.08.28 03:00 "[Tiff] 回复: hi i need you help", by 田村春树

Yeah, the libtiff library can solve your problem.you can use the TIFF function,my code is as follows,you can hava a look ,it may help you.

****************************************************************/int Extract(int i_wavelength,int k,int _Width,int _Stride,int _Height, unsigned char* p_buff){ TIFF *image;    char szFileName[100];   uint16 spp, bpp,image_width, image_height;      int i, j;       unsigned short array[209*206]={};       sprintf(szFileName,"F:\\chenjun\\data\\%d-%d.tif",i_wavelength,k+1);    image = TIFFOpen(szFileName,"w");       if((image = TIFFOpen(szFileName, "w")) == NULL) {               printf("Could not open output.tif for writing\n");              return 1;       }       image_width = _Width;   image_height = _Height; spp = 1; /* Samples per pixel */        bpp = 16; /* Bits per sample */ // We need to set some values for basic tags before we can add any data TIFFSetField(image, TIFFTAG_IMAGEWIDTH, image_width);//set the width    TIFFSetField(image, TIFFTAG_IMAGELENGTH, image_height);//set the height TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, bpp);//set the size of the channels  TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, spp);//set number of channels per pixel    TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, image_width*spp);     TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_NONE);     TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);       TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);      TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(image, TIFFTAG_XRESOLUTION, 48.0); TIFFSetField(image, TIFFTAG_YRESOLUTION, 48.0); TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);      for (i=0; i <_Height; i++)      {               //Cast the raw image buffer to a 16-bit array.          //...Assumes the PixelEncoding is 16-bit.               unsigned short* ImagePixels = reinterpret_cast<unsigned short*>(p_buff);                //Process each pixel in a row as normal         for (j=0; j< _Width; j++)               {                       array[ i*_Width+j ] = *(ImagePixels+j);         }               //Use Stride to get the memory location of the next row.                p_buff += _Stride;              TIFFWriteScanline(image, &array[i * _Width], i, 0);     }       // Close the file       TIFFClose(image);       return 0;}


----- 原始邮件 -----
发件人:이강훈 <chinggu88@gmail.com>
主题:[Tiff] hi i need you help
日期:2015年08月17日 13点52分

hi i student in korea!

i use libtiff library!

i have one question.

i deal with geotiff file!

so i want that that is convert xy pixel to xy coordinate~

GDAL library can solve this problem but GDAL library is very different and difficult more than any library!

Can libtiff library solve this problem?

if libtiff library can solve this problem. i use what kind of libtiff fuction!?