Hello.
ImgStream2 contains a scanned image.
The following code converts the image from BMP to TIFF:
procedure TImageListItem.MyTest;
var LBmp : TIEBitmap;
LImgIO: TImageEnIO;
begin
// Test file 1...
TMemoryStream(ImgStream2).SaveToFile(OmTmpPath + 'Img.bmp');
// Convert...
LBmp := TIEBitmap.Create;
LImgIO := TImageEnIO.Create(nil);
try
ImgStream2.Position := 0;
LImgIO.AttachedIEBitmap := LBmp;
LImgIO.Params.TIFF_ImageIndex := 0;
LImgIO.LoadFromStreamFormat(ImgStream2, IEExtToFileFormat('bmp'));
LImgIO.Params.TIFF_Compression := ioTIFF_G4FAX;
TMemoryStream(ImgStream2).Clear;
LImgIO.AttachedIEBitmap := LBmp;
LImgIO.SaveToStream(ImgStream2, IEExtToFileFormat('tif'));
// Test file 2...
TMemoryStream(ImgStream2).SaveToFile(OmTmpPath + 'Img.tif');
finally
LBmp.Free;
LImgIO.Free;
end;
end;
Sometimes the TIFF file is corrup after conversion,
Preview:

BMP and TIFF file:
http://www.officemanager.de/tmp/foren/imageen-bmp2tif.zip
I'm using ImageEn 3.1.1 with Delphi 2009.
Can you see an error in my code?
Thanks, Harald
Document Management http://www.officemanager.de