AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.12.29 11:32 "[Tiff] (no subject)", by Jamel BEL HADJ BRAHIM
2004.12.29 11:44 "[Tiff] Can't Encode with TIFFTAG_FILLORDER= FILLORDER_LSB2MSB", by Jamel BEL HADJ BRAHIM
2005.01.23 16:43 "[Tiff] LibTiffDelphi", by --+
2005.01.24 01:17 "Re: [Tiff] LibTiffDelphi", by Sherlog
2005.02.08 16:43 "Re: [Tiff] LibTiffDelphi", by Joris
2005.02.21 00:31 "[Tiff] problem viewing tiff-file", by Michel Brabants
2005.02.21 00:44 "Re: [Tiff] problem viewing tiff-file", by Michel Brabants
2005.02.21 01:40 "Re: [Tiff] problem viewing tiff-file", by Frank Warmerdam
2005.02.21 05:06 "Re: [Tiff] problem viewing tiff-file", by Bob Friesenhahn
2005.02.21 13:45 "Re: [Tiff] problem viewing tiff-file", by Michel Brabants

2004.12.29 11:32 "[Tiff] (no subject)", by Jamel BEL HADJ BRAHIM

Thanks,

return value of TIFFWriteEncodedStrip is 3725568

XSIZE 1728

YSIZE 2156

I usually obtain a black image. (?????????????????)

(I work on Windows XP)

Thank you for help

My code is:

HBITMAP hImage = (HBITMAP)LoadImage(NULL, "C:\\test001.bmp", IMAGE_BITMAP,

      0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE|LR_CREATEDIBSECTION);

CBitmap* m_Bitmap = CBitmap::FromHandle(hImage);

BYTE* buffer=(BYTE*)GlobalAlloc(GPTR, XSIZE * YSIZE);

DWORD ret = m_Bitmap->GetBitmapBits(XSIZE * YSIZE, buffer);

out = TIFFOpen("C:\\out.tif", "w");

 if (!out) return;

TIFFSetField(out, TIFFTAG_IMAGEWIDTH, XSIZE); TIFFSetField(out,
TIFFTAG_IMAGELENGTH, YSIZE); TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1); TIFFSetField(out,
TIFFTAG_ROWSPERSTRIP, YSIZE); TIFFSetField(out, TIFFTAG_SUBFILETYPE, 0);

TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);
TIFFSetField(out, TIFFTAG_GROUP4OPTIONS, 0); TIFFSetField(out,
TIFFTAG_FAXMODE, FAXMODE_CLASSF); TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_MINISWHITE); TIFFSetField(out, TIFFTAG_PLANARCONFIG,
PLANARCONFIG_CONTIG); TIFFSetField(out, TIFFTAG_FILLORDER,
FILLORDER_LSB2MSB);

TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); TIFFSetField(out,
TIFFTAG_XRESOLUTION, 204.0); TIFFSetField(out, TIFFTAG_YRESOLUTION, 196.0);
TIFFSetField(out, TIFFTAG_DATETIME, "2004:12:23 10:17:19");
TIFFSetField(out, TIFFTAG_SOFTWARE, "Jamel"); TIFFSetField(out,
TIFFTAG_PAGENUMBER, 0, 1);

uint32 ret = TIFFWriteEncodedStrip(out, 0, buffer, XSIZE * YSIZE);

 TIFFClose(out);

GlobalFree(buffer);