Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I scan a 300dpi image and save in TIFF format using Delphi?
    primarykey
    data
    text
    <p>I'm using Delphitwain (delphitwain.sourceforge.net) to add scan functionality to my app. Scanning is working fine and I can save bmp and jpeg files. Now I need to:</p> <ul> <li>save in 300dpi (the scanner is capable)</li> <li>save in TIFF format</li> </ul> <p>After digging around, I found 2 tips:</p> <p><a href="http://www.delphipraxis.net/132787-farbstich-nach-bitmap-operation.html" rel="nofollow">http://www.delphipraxis.net/132787-farbstich-nach-bitmap-operation.html</a></p> <p><a href="http://synopse.info/fossil/wiki?name=GDI%2B" rel="nofollow">http://synopse.info/fossil/wiki?name=GDI%2B</a></p> <p>Here is my final code:</p> <pre><code>procedure TForm1.GoAcquireClick(Sender: TObject); begin Counter := 0; Twain.SourceManagerLoaded := TRUE; Twain.LoadSourceManager; Twain.TransferMode := ttmMemory; with Twain.Source[ 0 ] do begin Loaded := TRUE; SetIXResolution(300); SetIYResolution(300); SetIBitDepth(1); EnableSource(true, true); while Enabled do Application.ProcessMessages; end; end; procedure TForm1.TwainTwainAcquire(Sender: TObject; const Index: Integer; Image: TBitmap; var Cancel: Boolean); var TiffHolder: TSynPicture; begin Inc( Counter ); Current := Counter; ImageHolder.Picture.Assign( Image ); ImageHolder.Picture.Bitmap.Monochrome := true; ImageHolder.Picture.Bitmap.Pixelformat := pf1Bit; SynGDIPlus.SaveAs(ImageHolder.Picture, format('c:\temp\teste%d.tif',[ Counter ]), gptTIF ); end; </code></pre> <p>Result: the image still is 96dpi and were saved as BMP (even with TIF extension).</p> <p>What am I missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload