Friday, June 25, 2010

It's Friday Blogging Night: Image formats

A couple of days ago, we were enlightened by the type of images we use and how these images are compressed and saved! And in this blog, I shall tell you what I have "seen". Apparently, those .png, .tif. .jpeg matters a lot when it comes to data storage specially if it involves images.

So what are these image types basically?

1. You know those black and white images? No? Yes? Well, they are called BINARY IMAGES. That's right! Binary like 1 and 0. because basically, the contents of those are *drumroll* 1 and 0. Yay! They are called BITS. And a 256x 256 image is only 8KB!An example of this is shown here:

This picture BITS really hard. Get it? *fake laugh* *embarrased*

note: this is only an example. file info of this is in indexed form. I can't find binary format.

2. Next on the list are GRAYSCALE images. If the binary was the cro-magnon, GRAYSCALE images are like the Cro-magnon .....with a CLUB. *dan dan dan* And a cro-magnon with a club is like more evolved. So why is it that it is called grayscale? Two words. Gray. Scale. Huh? Basically, It is like the binary but scaled in in 256 levels like in a Ragnarok Private Server. Information are recorded from 0 to 255 that's why there are a lot of shades of black that we say gray. A 256 x 256 grayscale image is around 64KB. Still don't know what a grayscale image is? See below:

Below.

note: the image is indexed. but for qualitative identification it it shown as grayscale.

3. This is when images discovered the Steam Engine! It gave color to the way we live. Next off are TRUEcolor images. And it does not LIE. Get it? No? Because it does not give FALSE information. Get it? No? Gaaaah. >__<. Truecolor images have channels or bands. These bands are usually in sets of 3. RGB. And the number of concentration of intensity in each band determines the color. These images are commonly seen in cameras. Specially, those cameras that take pictures of beauty.
This is Lena. Boys, behave! She's old. And this is a truecolor image of her.

FileName: C:\Users\Celestino\Pictures\Scilab pics\AP 186\trucolorimage.png
FileSize: 474648
Format: PNG
Width: 512
Height: 512
Depth: 8
StorageType: truecolor
NumberOfColors: 0
ResolutionUnit: centimeter
XResolution: 28.350000
YResolution: 28.350000


On a side note: A 256x256 true color image is around 192KB

4. Indexed image. This is when they junked the steam engine and became more efficient by making FORD motors to make gasoline engines. Instead of having 3 Bands of colors, They indexed color information on what they call a colormap. In this way, there are 2 sets of data being stored. This makes the image colored, and basically cover less memory space. Though it may reduce the color information.

Gaaawk! Polly wants an indexed cracker. Gaaawk!

FileName: C:\Users\Celestino\Pictures\Scilab pics\AP 186\Indexed image.png
FileSize: 25576
Format: PNG
Width: 150
Height: 200
Depth: 8
StorageType: indexed
NumberOfColors: 256
ResolutionUnit: centimeter
XResolution: 72.000000
YResolution: 72.000000



5. Other types. If number 4 is a gasoline engine. Next types are almost StarWars-y. They they are like the DeathStars because it is do high-tech. To mention a few, there are HDR in which recording are more than 8-bit. Multispectral and Hyperspectral where bands are not limited to RGB. And their name is so cooool. There are 3D images. They maybe the Chemical X in Imax-or not. They are used in MRI and CT(not City) scans. And lastly, the Cadillac of the movie industry, Temporal images or Video.


I didn't know Temporal Images makes me cry. Seriously.

Notice those file extensions like .jpeg .gif? These three little letters after the dot of your filemane matters. As you can see, these formats your image and then saves it. Here's the catch. In formatting, depending on the image format, there are some informations that are lost. Because in formatting, they are compressed to not allow hoarding of memory.

There are this lossLESS image compression in which EVERY PIXEL is PRESERVED. And the other is lossY image compression. Well, as the term implies it lossY-es information. What is the trade-off? The trade off is MEMORY. sweet sweet. MEMORY. That is why you need to know what type of file extension you need to use. If you need every bit for information, don't ya worry about saving memory. use .png, .tif extensions. if just for saving memory, use those lossY like .jpeg.

Results From The PRODECURE.

This is my initial scanned image:
What a graph.

It's size was 286 pixels for height and 320pixels for width. There is this 3 that I don't know what it says.

Taking Lena as my truecolor image, with its imfinfo up above, I tried to make a binary and grayscale image of her.

Lena again... Oh lala.

Grayscale image looked like this:


She's still beautiful aint she?


It has a size of 512 x 512

with imfinfo of:

FileName: C:\Users\Celestino\Pictures\Scilab pics\AP 186\trucolorimagegray.png
FileSize: 955736
Format: PNG
Width: 512
Height: 512
Depth: 16
StorageType: truecolor
NumberOfColors: 0
ResolutionUnit: centimeter
XResolution: 72.000000
YResolution: 72.000000


And this is when Lena is in Black and White:


Even in black and white, she dazzles me.

It has a size of 512x512.

And has a imfinfo of:

FileName: C:\Users\Celestino\Pictures\Scilab pics\AP 186\trucolorimagebw.png
FileSize: 21098
Format: PNG
Width: 512
Height: 512
Depth: 16
StorageType: truecolor
NumberOfColors: 0
ResolutionUnit: centimeter
XResolution: 72.000000
YResolution: 72.000000


Let us go back to the scanned image of the graph. This is a grayscaled image of the scanned graph.:

Grayscaled Gino004

And the Black and White image of the scanned graph after having to know the histogram of grayscale distribution, I used im2bw(, 0.9).


Black and White image.

As I can notice, the reconstructed Black and white image looked DARKER. It seems so because of the threshold value I put on the im2bw(). This somehow cleaned up certain colors.

By the way, little history on selected filename extensions on images.

1. JPEG
2. PNG


By the way, I think I'd have a grade of 8 out of 10 for this activity because I am unable to find certain types of images.


And I would like to acknowledge the help of my roomates. Wikipedia for certain images. Ang Maam Jing for most of the intellectual input.

No comments:

Post a Comment