Thursday, June 20, 2013

Image types and formats

I feel like our generation now is so fascinated with the digital world. Whether taking pictures, using in industry and other practical purposes, image representations are vastly used. For our fourth activity, we are asked to know and be familiar with the different types and formats of an image. At first, I thought that this will not be as exciting as the previous activities because you only have to research for the most part of it. But then Ma'am told us that image formats have its nature and reason why it is used. So, I may not know what I could discover.

A little exploration on the different image formats

Different image formats that I browsed in my personal computer and others that I searched on the web were shown below. The JPEG file is a picture taken by a camera, TIF file is a SEM (Scanning Electron Microscope) image of Indium Oxide, BMP file is obtained from [1] and the PNG file is obtained from [2].

Digital images with different formats: JPEG (upper left), TIF (upper right), BMP (lower left), and PNG (lower right).

And here is my favorite image file format, obtained from a dear friend of mine. 

An animated GIF image.

The properties differ for each of the image formats. Table below shows some of the important properties of the digital images.


It was observed that for JPEG and TIF, they have more properties. Aside from the Image and File properties indicated by blue letters in the first column of the table, there are Description, Origin, Camera and Advanced Photo properties. Camera properties include camera model, exposure time, ISO speed, etc. while advanced photo properties include lens model, contrast, brightness, saturation and other camera settings. However, most of them have no designated detail/ value. 


Differences on the image formats

As the image storage grows bigger and bigger, the need to compress image files also becomes greater. The knowledge about different file extension will help you save your image containing just the right amount of information that you need. The image compression can either be lossy or lossless. Lossy compression lets the image loss some of its information for smaller file size while lossless compression preserves every information about the image.

JPEG formats. One of the most common image file type (and the most format of image in my laptop) is the JPEG. This employs big compressing ratio, an optimized format for photographs – make use of digital cameras. Although, you can choose the compression of the images in the camera setting, the compression works based on how the human eye notices colors. It stores information to depth of 24 bits omitting the information that the eye least likely to recognize.

TIF formats. Though a flexible image format, TIF is exclusively for lossless image storage. Usually, it uses no compression at all which is used in high color depth images. In my example of TIF file format come from image taken by the SEM. The SEM, a property of the CMPL, captures images of the sample structures in sub-micron level. I thought that TIF format was used here because images of very small samples cannot afford any loss of information.

BMP formats. It is an uncompressed format used by Microsoft Windows graphics subsystem (GDI).

PNG formats. PNG is an image format that utilizes lossless compression. It finds patterns on the images for compression.

GIF formats. GIF format saves the images into 256 colors only. For true color images, which contains up to 16 million colors, losses much information when saves as GIF. It is used in line arts with only limited number of colors and for small animation like the image I presented a while ago.

RAW formats. RAW format is a lossless image storage that is available in some digital camera so if you would want the unprocessed version of photographs.

As a summary and what one can already deduce, less compression would result to bigger file size than those with bigger compressions. However, bigger compression would lose bigger information about the image. So image formats will help you choose the compression you want on your image.

[* Almost all information about different image formats are obtained from references 3-6. ]


Playing with the image color using GIMP

Exploring the JPEG-formatted image in GIMP, the following were found

Using GIMP, image properties (left) and the histogram (right) of an image can be displayed. 

The same image were manipulated using GIMP, producing effects or filters (see figure below). The effects used were grayscale mode, black and white (using only 1-bit pallete), and the indexed color (first blues then red). All were build-in settings in the GIMP but there were also menus (especially the colors menu) where you can made your own changes like for example, choosing the amount of color of cyan, magenta, and yellow in the picture. I tried the threshold settings where the produced image is on the middle right. Compared to the b&w image on the left, the details in the threshold-manipulated image is more prominent. So I think, depending on your taste, GIMP can possibly do it. And it was just so cool.

Manipulating a picture with the original version on the upper left.

When the image were manipulated, there are properties that were changed in the image. The obvious one is the size, which depends on the type that you choose or the color index.


The art in using Scilab

Images can also be controlled using Scilab. By installing SIVP module, a lot of commands are available to perform things done in the GIMP. Examples are imread, imshow, imwrite, imfinfo, etc. With the help of the Scilab help browser, using these commands had been easier.  Summary of the commands that I learned to use is presented in the code below.


Each line contains comment explaining what it do. In using im2bw in line needs an argument named threshold which, as described in the Scilab help, is a value from 0 to 1 describing the amount of luminance  which then dictates the bound for which pixels should have a true and false value, or the white and black color. In line 4, info will contain the properties of the penguin image. When typed in the console, the information that were obtained were tabulated below.


The rest of the code simply manipulates the color of the original image. The difference between the imshow and imwrite is that the latter save the image into the file while the other just displays it in a window. The original image can also be converted to other formats as performed in line 7 and obviously its size was drastically changed from 2.25 MB to 112 KB. That is from lossless to lossy (compressed format).  The size and the color type for other converted images were also changed. The original compared to the converted images were presented in the succeeding Figure.

Manipulating a picture using Scilab. The original image is on the upper left, grayscale on upper right, black and white on lower left and applying filter on lower right. 

I give myself a 10/10 :)

***
I am very thankful to a loooot of people for the content of this blog.

I thank Phoebe Gallanosa for letting me use her list of image properties so all I need to do is to fill up the details. It's just sad that I wasn't able to use a big portion of the list because for most images, it was not filled up.

I acknowledge the Condensed Matter Physics Laboratory facilities particularly the SEM where I get the image of the Indium Oxide structure.

I would also like to thank Aeriel Constantino and my highschool friend, Crisilyn Paguio, with whom I got the picture in the grassland and the gif picture both taken way way back.

I thank Nestor Bareza for helping me install the SIVP module in my laptop and teaching me to use few common commands.


_____________________________________
References
[1] http://www.goldenborders.com/graphic/Miscellaneous/miscellaneous%20(136).bmp
[2] http://upload.wikimedia.org/wikipedia/commons/e/e6/Big.Buck.Bunny.-.Landscape.png 
[3] Soriano, M. "Image Types and Formats." AP 186 Laboratory Manual. National Institute of Physics, University of the Philippines, Diliman. 2013.
[4] Digital Image File Types Explained. Retrieved from http://users.wfu.edu/matthews/misc/graphics/formats/formats.html
[5] Aguilera, P. Comparison of different image compression formats. Retrieved from http://homepages.cae.wisc.edu/~ece533/project/f06/aguilera_rpt.pdf?ifr
[6] Graphics Interchange Format. Retrieved from http://en.wikipedia.org/wiki/Graphics_Interchange_Format

No comments:

Post a Comment