| Author |
Topic  |
|
|
wskelton3

USA
11 Posts |
Posted - Sep 27 2011 : 15:02:45
|
I have an accounting application (Delphi 2007 & ASA 11) to which I want to be able to add the ability to scan working documents and attach them to invoices in BLobs efficiently. Later I want to be able to view, print and save the image to a PDF file. The code is working fine using JPEG.
I would like some input on the best image choice to minimize space in the database while maintaining image quality.
Thanks. |
|
|
xequte
    
39219 Posts |
Posted - Sep 28 2011 : 00:58:26
|
Hi
JPEG is not a good choice for scanned documents because solid text will show a lot of artefacts (it is most suited to photos where the degredation is not so noticeable).
You should use a lossless format which compresses well, such as PNG.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
|
wskelton3

USA
11 Posts |
Posted - Oct 17 2011 : 13:49:05
|
Ok, as I move on with my project I run into the following...
I want to acquire multiple pages (Epson GT-S50 scanner) and save them to my DB. To use ImageEnMView I need to choose GIF or TIFF to save multiple images in a single DB row, right? Using GIF and scanning 5 to 6 pages, the image size grows to 1.5mb, and I get "Invalid Blob Size" error saving the image to my SQL Anywhere ver 11 DB via the BDE.
On the other hand, using ImageEnIO and attempting to catch the image during ImageEnIO1AcquireBitmap and save one image per row, I can't get the ImageEnIO1AcquireBitmap to fire. The scanner scans all pages but only displays the first in my Timage. If I use OpenAcquire and CloseAcquire, the Acquire statement doesn't display the scanner dialog nor does it fire ImageEnIO1AcquireBitmap.
Which option will work giving me the best quality image with the least use of DB space. I am scanning letters, invoices, etc. - no high quality pictures or other graphics.
Thanks
Here's the code I'm using....
procedure TfmScanit.ImageEnIO1AcquireBitmap(Sender: TObject; ABitmap: TIEBitmap; var Handled: Boolean); var ts:TMemoryStream; begin try ts:=TMemoryStream.Create; try dmSC.tblScans.insert; ImageEnIO1.AttachedIEBitmap:=ABitmap; ImageEnIO1.SaveToStreamPNG(ts); dmSC.tblScansImage.LoadFromStream(ts); dmSC.tblScans.post; dmSC.tblScans.last; handled:=false; except MessageDlg('Error scanning/saving the document.',mtError,[mbOk],0); dmSC.tblScans.Cancel; end; finally ts.free end; end;
procedure TfmScanit.pnlScanitClick(Sender: TObject); begin pnlScanit.Color:=clRed; FillIn; ImageEnIO1.AcquireClose; ImageEnIO1.TWainParams.FeederEnabled := true; ImageEnIO1.TWainParams.AutoFeed := true; ImageEnIO1.TWainParams.DuplexEnabled := true; ImageEnIO1.Params.PNG_Filter:=ioPNG_FILTER_PAETH; ImageEnIO1.Params.PNG_Compression:=9; // ImageEnIO1.AcquireOpen; ImageEnIO1.Acquire(ieaTWain); // ImageEnIO1.AcquireClose; pnlScanit.Color:=clNavy; end;
|
 |
|
|
fab
   
1310 Posts |
Posted - Oct 17 2011 : 14:07:55
|
quote: I want to acquire multiple pages (Epson GT-S50 scanner) and save them to my DB. To use ImageEnMView I need to choose GIF or TIFF to save multiple images in a single DB row, right? Using GIF and scanning 5 to 6 pages, the image size grows to 1.5mb, and I get "Invalid Blob Size" error saving the image to my SQL Anywhere ver 11 DB via the BDE.
I'm sorry, I don't know the reason for this. Check your DBMS documentation.
quote: On the other hand, using ImageEnIO and attempting to catch the image during ImageEnIO1AcquireBitmap and save one image per row, I can't get the ImageEnIO1AcquireBitmap to fire. The scanner scans all pages but only displays the first in my Timage. If I use OpenAcquire and CloseAcquire, the Acquire statement doesn't display the scanner dialog nor does it fire ImageEnIO1AcquireBitmap.
OnAcquireBitmap fires only between AcquireOpen and AcquireClose. Make sure that ImageEnIO.TwainParams.VisibleDialog=true. Anyway the best choice to scan multiple pages is to simply use TImageEnMView.
quote: Which option will work giving me the best quality image with the least use of DB space. I am scanning letters, invoices, etc. - no high quality pictures or other graphics.
For B/W multipage images you should choice TIFF with G4FAX compression. Look this topic for other details: http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=139 |
 |
|
| |
Topic  |
|
|
|