Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
hello friends,
 
i want to save images in a database and want to 1st compress it, or make it small size so that database will be of small size. How to do that? Using SQL 2005 database.
Posted 28-Jun-13 8:02am
BCD23392
Comments
ThePhantomUpvoter at 28-Jun-13 13:05pm
   
http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx
Sergey Alexandrovich Kryukov at 28-Jun-13 13:41pm
   
It may make sense, but usually image-specific compression is used (JPEG, PNG and a lot more). Please see my answer.
(OP just confirmed that this is what's needed: JPEG.)
—SA
Sergey Alexandrovich Kryukov at 28-Jun-13 13:35pm
   
Lossless or lossy (like JPEG)? Image-specific or general purpose. Image compression comes with System.Drawing.Bitmap.
—SA
BCD23 at 28-Jun-13 13:39pm
   
JPEG images. image specific
Sergey Alexandrovich Kryukov at 28-Jun-13 13:41pm
   
Good, you have my answer; this is all you need.
—SA
BCD23 at 28-Jun-13 13:48pm
   
Using this should i get less database size than normal? And is there another way of saving images in database by maintaining size of database? want to retrieve it also in image viewer. so no resolution compromise.
Sergey Alexandrovich Kryukov at 28-Jun-13 13:57pm
   
I don't know what do you call "normal". Just follow my advice, experiment with compression parameters and resulting compressed data sizes. Nobody can tell you anything exactly in advance. Do you understand that real compression ratio depends on the content of the image? It will be lower with the images having more fine detail.
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Please see my comment to the question and this: http://en.wikipedia.org/wiki/Lossless_compression[^],
http://en.wikipedia.org/wiki/Image_compression[^].
 
For compression specific to images and standard image compression algorithms, please see:
http://msdn.microsoft.com/en-us/library/ms142147.aspx[^],
http://msdn.microsoft.com/en-us/library/9t4syfhh.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.imaging.imageformat.aspx[^].
 
In each format, find and read its specification, to learn about its compression quality, compression rate vs quality and other related properties. This topic is too big to cover in a Quick Answer, but you can easily find a reasonably good option for your purpose; just do some minimal research and experimenting.
 
—SA
  Permalink  
v2
Comments
CPallini at 28-Jun-13 15:06pm
   
5.
Sergey Alexandrovich Kryukov at 28-Jun-13 17:11pm
   
Thank you, Carlo.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 BillWoodruff 173
3 Sergey Alexandrovich Kryukov 170
4 PIEBALDconsult 160
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 28 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100