by Manikantan (12 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 25th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Describes Image Compressions Using Visual basic with Code Example
Manikantan
3rd Agenda,
Web Development,
India.
Website:www.3rdagenda.com
Email:[email protected]
Image Compression techniques.
Visual Basic Renders any image into a bitmap regardless of the image type mentioned
But it allows the compression of 24 bit images of bitmap type.
Consider a 24 bit bitmapped Image of Size 50 x 50.So there are totally
2500 pixels and each occupying 2500x24 bits, so in case of a bitmap the size can be
identified with the resolution.Consider a bitmap image of 50 x 50 with white background
and a single point with a color dot.The size of the image will be 2500 x 24 bits
But imagine the level of redundancy in the storage large volume of the size is occupied
by the white color which is respresented by &FFFFFF.Image Compression techniques plays its role here
in this type of image where the level of redundancy of the image bits are really high.Higher the
redundancy the higher the compression can be achieved.
there are different levels of compressions but the major one that is used is called as the
runlength encoding.Which follows the following concept.
1 1 1 1 1 1 1 1 1 1 0 0 1 1 1
if the data is stored in the above format it can be rewritten as 10 00 111
ie there are 10 ones in the above list so changed to 10 1 00 111.This is the basic
principle of run length Encoding or RLE.
I am using my own algorithm for compression and I am getting a 33% compression for
images with enhanced backcolor redundancy.
1)Read all the pixels using point method of the picture box
Load a picture to a picture box ,once the image is loaded to the picture box it
can be read as a two dimensional using the scaleheight and scalewidth of the picture box
for xaxis= 0 to picturebox.scalewidth
for yaxis = 0 to picturebox.scaleheight
lng_pixel=picturebox.point(xaxis,yaxis)
next yaxis
next xaxis
this long value can be stored to a file and second level can be done
2)I call the second level as the Pattern Matching.
Where this 8 digit long integer is replace by a Single number having a help of a lookuptable
Some thing like replace("166657","1") can be used
3)RLE
On the Patternmatched data the Encoding can be done.This will give a max of 33% of compression.
4)Decompression.
Since we follow our own algorithm we need to get the image back using our program only.
The decompression can be done on the reverse way using runlength Decoding and pattern
rematching.Now the Original image can be obtainted using the pset method of the picture box
for xaxis= 0 to picturebox.scalewidth
for yaxis = 0 to picturebox.scaleheight
lng_pixel=picturebox.psett(xaxis,yaxis),colorvalueread
next yaxis
next xaxis
.
Manikantan
Email:[email protected]
No comments have been posted about Describes Image Compressions Using Visual basic with Code Example. Why not be the first to post a comment about Describes Image Compressions Using Visual basic with Code Example.