Image compression from scanner to database

C

Corobori

I am writing a vb.net application where I need to store image in a SQL
Server database, yes I know I shouldn't but my clients wants it and
has his reasons to do so. In order to reduce the database size I was
wondering how I could compress the image (coming from a scan made by
Pegasus TwainPro). I saw some possibility in the TwainPro doc but the
samples do not contain much description. I was thinking of using Xceed
Streaming Compression to do the job. Any comments ?

Jean-Luc
www.corobori.com
 
P

Paul Bromley

Hi,

Are you using ImagXpress with Twainpro?? What image format are you using? I
use ImagXpress to produce monochrome multi-page Tiffs an get very good
compression. If you need soem code based on this, then let me know. Not sure
if you can achieve much compression with Twainpro by itself, as I do the
image manipulation in ImagXpress. If you only have Twainpro, and you are
looking for mono Tiff compression then let me know and I will take a look to
see if the same compressiong can be achieved using Twainpro. Generally the
Tiff images are below about 30K depending though on waht the actual original
documnets are - big logos cause heftier file sizes.

Best wishes

Paul Bromley
 
P

Paul Bromley

Correction,

Ignore a lot of the code below as it refers to other code in my project.
I do use the TwainPro component to set maximum compression on the TIFF fle
prior to saving. For TwainPro4:-

Dim ScanCount As Integer
Dim strTemporaryFileCreationTime As String
Dim strTemporaryFileName As String
Dim strFileDate As String
ScanCount = 1
Try
strFileDate = Date.Now.ToString("hhmmss")
strTemporaryFileCreationTime = "image-" & ScanCount.ToString & strFileDate &
".tif" 'Format(Now, "hh*mm*ss")
strTemporaryFileName = objGetPath.TemporaryFilesPath &
strTemporaryFileCreationTime
TwainProNet.SaveTIFCompression =
tagenumSaveTIFCompressionType.TWTIF_CCITTFAX4
TwainProNet.SaveFile(strTemporaryFileName)
ImagMain.AutoSize = enumAutoSize.ISIZE_ResizeImage
ImagMain.ApplyGrayscaleTransform()
ImagMain.FileName = strTemporaryFileName
LoadThumbArray() 'Reload the Image array
ScanCount = ScanCount + 1
tmrClearImage.Enabled = True
ThumbTop.Visible = True
lblThumbTop.Visible = True
ThumbBottom.Visible = True
lblThumbBottom.Visible = True
Catch
End Try


Best wishes

Paul Bromley
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Corobori) scripsit:
I am writing a vb.net application where I need to store image in a SQL
Server database, yes I know I shouldn't but my clients wants it and
has his reasons to do so. In order to reduce the database size I was
wondering how I could compress the image (coming from a scan made by
Pegasus TwainPro). I saw some possibility in the TwainPro doc but the
samples do not contain much description. I was thinking of using Xceed
Streaming Compression to do the job. Any comments ?

You could try to save the bitmaps (if you have 'Bitmap' objects
containing an uncompressed bitmap) to a 'MemoryStream' in JPEG format,
for example. Then you could read the data from the memory stream and
save it into the DB as a BLOB.
 
C

Corobori

That is somehow the way I went. I am saving it in Jpeg format and then
compress it using the XCeed component. The quality of the image is not
so important as I am storing document not picture. A BMP was way to
heavy.

Jean-Luc
www.corobori.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top