What is the most compact way to save Image in SQL server

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I need to save lots of images on potentially very large database. Therefore the storage space is very crucial. I need what is most compact way to save an image. Currently I am using something like thi
Thanks in advanc
A

dim IoImageValue() As Byt
….get the bytes from InkPictureBox control
myDataRow("Graph") = IoImageValu
 
Hi Al,

There is no compact way, as far as I know is every image format (excluding
Tiff) already compacted.

Every time you delete something you delete also something from the image.

If that is not important you can look at the thumbnail method, very easy to
use if you already know how to make a bytarea from an image as I see.

I hope this helps,

Cor
I need to save lots of images on potentially very large database.
Therefore the storage space is very crucial. I need what is most compact way
to save an image. Currently I am using something like this
 
uhhh Cor... not quite :-)

Both lossless and lossy compression algorithms exist. And it seems that the
OP will consider lossy compression in order to save space.

With lossy compression it becomes a matter of how much detail is required to
convey the information you are trying to convey. And just as an example...
you can create a 2.3 MB bitmap and simply store it in a .ZIP file obtaining
99% compression and a file that is 3K in size. In this case it is a single
color bitmap. The compression (in the case of .zip "lossless compression")
depends upon the image.

Tom
 
Hi Cor
Thanks for the comments; I was just wondering if there is more efficient way of saving images than what i am doing
A
 
Hi Al,

Compression is a trade-off of time for space. Lossy compression
additionally trades off information for even more space. The trouble with
lossless compression is that it typically won't do well on binary data such
as images, audio and the like.. The reason I got such great compression on
the example I gave is only because I made the image a single color.
Obviously most images won't be a single color and a photograph will compress
a few percent at most (depending upon the format.)

The way you get the greatest compression is by storing the image in a lossy
format (as opposed to a lossless format.) Compression in JPEG images for
instance can be controlled and you can decide how much detail to lose. As
you lose detail you gain additional compression.

You have to base your decision on what the images consist of (line drawings
or photographs) and what the purpose they are ultimately intended for. If
they are going to be displayed on a web page there is both a limit to how
long somebody will wait for the image and a resolution beyond which the
viewer doesn't care. So basically experiment a little bit and decide what
is an acceptable loss of quality.

It is pointless BTW to apply .ZIP compression to a JPEG image and it
actually should grow bigger as a result. Remember that JPEG "is" a
compression algorithm, if it was possible to compress the image even more
then JPEG would simply do it. Once the data is "random" further compression
becomes impossible.

Tom
 
Back
Top