#1 2011-07-07 22:44:35

josir
Member
Registered: 2011-07-07
Posts: 2

Converting scanned image to TIFF.

Hi folks,

I am trying to convert a scanned image to a TIFF image. I post the entire code in stackoverflow.

http://stackoverflow.com/questions/6615 … ing-delphi

Could you give me some insights showing me what did I miss?

Thanks in advance,
Josir Gomes

Offline

#2 2011-07-08 06:43:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,231
Website

Re: Converting scanned image to TIFF.

I've answered directly in SO.

Could you try the latest version and give some feedback?
http://synopse.info/fossil/info/58a0e22c54

Offline

#3 2011-07-08 07:06:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,231
Website

Re: Converting scanned image to TIFF.

I've posted an updated version. Need to work with EncoderCompression parameter instead, I think.

Offline

#4 2011-07-14 15:25:34

josir
Member
Registered: 2011-07-07
Posts: 2

Re: Converting scanned image to TIFF.

Hi Ab, I saw your post in SO. Thanks a lot.

I download the latest version and now it saves correctly in TIFF. But the compression is not working.
It always save in LZW. Here is the code:

procedure TForm1.TwainTwainAcquire(Sender: TObject; const Index: Integer;
  Image: TBitmap; var Cancel: Boolean);

begin
  Inc( Counter );
  Current := Counter;

  { Force the image to be Monochrome }
  Image.Monochrome := true;

  { ImageHolder is a TImage component attached on Form }
  ImageHolder.Picture.Assign( Image );

  SynGDIPlus.SaveAs(Image, format('c:\temp\opcao3%d.tif',[ Counter ]), gptTIF, ord(evCompressionCCITT4) );
end;

Do you have any tip on how to save using the correct compression?

PS: If you need it, I can send the whole project because I intend to distribute all source code freely.
You can also use this little project as an example for your component.

Offline

Board footer

Powered by FluxBB