468,783 Members | 1,645 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,783 developers. It's quick & easy.

Image compression from scanner to database

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
Nov 20 '05 #1
6 4225
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
"Corobori" <jl****@corobori.com> wrote in message
news:3b**************************@posting.google.c om...
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

Nov 20 '05 #2
Hi Corobori,

Compressing images is in my opinion always loosing information.

There is even the standard thumbnail method in dotNet.

Here a link about GDI+

http://msdn.microsoft.com/library/de...dmetafiles.asp

I hope this helps?

Cor
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

Nov 20 '05 #3
Paul,

Thanks for replying. I am using TwainPro only as I don't need to make
image manipulation. I saw a sample in TwainPro documentation but the
code wasn't complete, I would like trying your code.

BTW I was looking at XCeed Streaming Compression
http://www.xceedsoft.com/products/StreaNet/index.htm. Do you know this
product ?

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4
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
"Paul Bromley" <fl*******@dsl.pipex.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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
"Corobori" <jl****@corobori.com> wrote in message
news:3b**************************@posting.google.c om...
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


Nov 20 '05 #5
* jl****@corobori.com (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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
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
Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jason Murry | last post: by
7 posts views Thread by Jean Christophe Avard | last post: by
12 posts views Thread by Lance | last post: by
10 posts views Thread by =?Utf-8?B?UmludSBHb3BhbGFrcmlzaG5hIFBpbGxhaQ==?= | last post: by
1 post views Thread by Sumeet | last post: by
6 posts views Thread by Victory | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.