Home » Developer & Programmer » Forms » Data compression (oracleAS 10g win xp)
Data compression [message #423808] Mon, 28 September 2009 07:27 Go to next message
muzaffar2010
Messages: 16
Registered: May 2009
Location: usa
Junior Member
hello,

how to compress image ?

best regards.
Re: Data compression [message #423819 is a reply to message #423808] Mon, 28 September 2009 08:14 Go to previous messageGo to next message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
I presume you want to compress an image for storage on the database? Compress the image using any number of compression programs before storing on the database. You should consider at least two things however before you proceed:

1) decide if your image compression can be lossy or not. A NON-LOSSY compression process is one that is fully reversable. When you uncompress the image you get back exactly what you gave. A LOSSY compression process is one in which you are allowed to change the object being compressed slightly (or maybe a lot) and in the process of changing the object gain extra efficienty. But, when you reverse the process what you get back is not exactly the same as what you started with, and in some cases a LOSSY conversion is not reversable at all so you have to accept this if you choose so.

Most people using compression want a NON-LOSSY process because when they reverse the process, they MUST HAVE the original product after the uncompress operation. However, when you talk about images, most people actually want to use a LOSSY process because there are many very good LOSSY IMAGE COMPRESSION tools that can significantly shrink the bytes of an image with little and usually zero perceptable difference when the image is viewed by the human eye.

As an example of a lossy compression of images, do a printscreen of your windows desktop, open paintbrush and paste the snapshot of your screen in. Now save the image as a 24bit picture (the default). Now save the image as a 256 color image (use the second dropdown). You will see that the image looks a bit different as windows changed the color palatte to 256 colors but otherwise it is still the same image and perfectly usable for your purpose. However the file you have saved is only 1/3 the size of the original.

This example also illustrates an overlooked form of image compression, reducing the actual content of your image. There are many programs with much more sophisticated algorithms for doing this palette reduction process such that the modified image shows little or no difference when viewed yet is much smaller.

Additionally you will note that even though this image has been compressed so to speak, it is still an image file and viewable. The compression is a CLOSED algorithm in a sense because it took in an image file and it returned you an image file. The main thing to remember is that the your image is not the true original and the process is not reversable.

Of course you can also opt for something like ZIP compression. Taking the two files you saved, run them into ZIP and see what happens. This compresses them using a NON-LOSSY process and does what most people think of when you say compression. If you zipped these two files you will see that the zip process reduces each file down by some 80% to 99%. You will also see that the smaller palette image is again 1/3 the size of the other. In my case a 6mb image became 32kb image after both forms of compression were applied. The drawback of a zip style compression is that being "true" compression, you must uncompress the product before you can use it and this usually means having the uncompress capability on the receiving end where the image needs to be views, which can cause for deployment issues for having to deploye the uncompress capability. In our case of using zip, what ever was viewing the image would need to transparently unzip the image before using it.

2) decide if your compression must be portable, or not. Not all compression processes are portable. Make sure whatever ZIP style product you use has a compatible version on all the platforms you want to port to.

3) see if oracle database has some compression feature for raw datatype. Do some googling and read some documentation for that.

If all you want is to compress the image on the database, then you may be able to write an set of functions to do manage the compress in and uncompress out if you use a view and instead of triggers of other some such features.

However, you should consider that if these images are to be moved around your network then it will pay to use LOSSY COMPRESSION and NON-LOSSY COMPRESSION before sending the image across you lan/wan/internet.

Good luck, Kevin

Re: Data compression [message #423845 is a reply to message #423819] Mon, 28 September 2009 10:33 Go to previous messageGo to next message
muzaffar2010
Messages: 16
Registered: May 2009
Location: usa
Junior Member
thanks,

i don't want to use image resizing tools ,

i want oracle (pl/sql) code to do that.

best regards
Re: Data compression [message #423853 is a reply to message #423845] Mon, 28 September 2009 11:55 Go to previous message
muzaffar2010
Messages: 16
Registered: May 2009
Location: usa
Junior Member
hi,

i use this function ( Image_Zoom ),
when i insert the data to the table ... is the image size change?

best regards
Previous Topic: Sub Total
Next Topic: Tirggers Execution
Goto Forum:
  


Current Time: Thu Dec 08 22:10:49 CST 2016

Total time taken to generate the page: 0.07703 seconds