ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Convert JPEG to compressed TIFF
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

JanN

5 Posts

Posted - Oct 16 2012 :  02:41:33  Show Profile  Reply
Hi,

I have several JPEGs which have to be merged into one compressed black/white TIFF file. Unfortunately I cannot make it work with at least one file.

First try produced uncompressed file:

Tiff.IO.LoadFromBuffer(@ImageData[1], Length(ImageData), ioJPEG);
Tiff.IO.Params.TIFF_Compression := TIOTIFFCompression.ioTIFF_G4FAX;
Tiff.IO.SaveToFileTIFF(ImageFile);

Second try produces smaller but corrupt file (page looks strange):

Tiff.IO.LoadFromBuffer(@ImageData[1], Length(ImageData), ioJPEG);
Tiff.IO.Params.TIFF_Compression := TIOTIFFCompression.ioTIFF_G4FAX;
Tiff.IO.Params.BitsPerSample := 1;
Tiff.IO.Params.SamplesPerPixel := 1;
Tiff.IO.SaveToFileTIFF(ImageFile);

Any thoughts?

Regards,
Jan

fab

1310 Posts

Posted - Oct 17 2012 :  11:22:35  Show Profile  Reply
Hi,
you have to specify the pixel format (black/white). You have two options:

1) set TIFF_PhotometInterpret (photometric interpretation):
Tiff.IO.Params.TIFF_PhotometInterpret := ioTIFF_BLACKISZERO;


2) convert your image to black/white (there are other options to convert to B/W, for example, dithering, threshold, etc..):
Tiff.IEBitmap.PixelFormat := ie1g;

Go to Top of Page

JanN

5 Posts

Posted - Oct 17 2012 :  13:06:03  Show Profile  Reply
Thank you very much. Option no. 1 did the job. :)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: