MegaPixels and JPEGs
Up FITS Tutorial Intro Page MegaPixels and JPEGs Bits and Stretching

Colored Bits-O-JPEG

To understand why something as obscure as FITS is used, we need to understand something about JPEG (pronounce “Jay-peg”). JPEG is a compression that is applied to the image in order to reduce file space while preserving as much as possible of the image. There are different levels of compression ranging from low (pretty hard to tell the image is compressed) to high (looks horrible, but boy oh boy, you can fit a *ton* of images on a disk). In this day of big digital cameras and cheap hard drives, I usually use a very low compression factor. (Now here’s a gotcha – in Photoshop, the lower the number, the higher the compression. The highest number (12) is the lowest compression. I don’t know why, it just is.) JPEG compression is also a “lossy” compression. In other words, to compress a file it will change and throw away pixels. This can be a problem if you try to save a highly compressed image and then try to get some kind of fine detail off of the picture. I’ll skip how it compresses – just suffice to say that JPEG does.

JPEG is used everywhere – from the web to cell phones to top of the line digital cameras. Our final image will be JPEG, but the source image won’t be. We *start* with FITS files but will *end* with JPEG. (On Slooh, we get the final JPEG image. At the end of these chapters you will understand why it is difficult [but not impossible] to process any more information out of these JPEG images.)

Digital Color Composite

The next piece of info is what it takes to make a color image. I use a digital camera that is a 10.2 million pixel camera (10 mega-pixel). Does this mean I have 10 million color dots to play with? Well, yes. And no. The device used to gather light can be a CCD or CMOS chip, but they both behave in a certain way – they can only see Black and White. Yup, even though they save color images, they can only see in B/W! The individual pixels have filters to differentiate between Red, Green and Blue. The colored filters are placed in front of each individual pixel so that one pixel would only see red light but record it in B/W. The camera takes each of these color-filtered pixels and with its own little built in computer converts the B/W dots into a composite color image.

The pixels are arranged in a particular pattern that can vary form manufacturer to manufacturer, but are usually in an array that looks something like:


(where the colors are R-ed, G-reen and B-lue.)

In the example above, we’re dealing with an image that has 16 pixels, but only 4 of them are red, 4 are blue and 8 are green. (The green pixel count is usually doubled since this is the color spectrum that our eye sees in its entirety and is where the camera extracts detail.) But if you look *between* the pixels, they form a grid (X shaped) where there is always a RGBG pixel on each side.  On the example above, the first one is RGGB, then GRBG, then RGGB, then GRBG, etc. Digital cameras naturally take “soft” images. (They look a bit out of focus.) However, all cameras have a sharpening filter to compensate for this. (In the camera’s menu, look for “Sharpening”. If it’s -2, -1, 0 +1, +2, at -2 it’s not purposefully causing the image to be out of focus. It’s just applying little or no sharpening at all.)

Some cameras deliver files called “RAW”. These are files that have not been manipulated by the camera – it’s the raw data. It’s left up to you to process it. (This is very much like working with a FITS file.)

So on my 10 mega-pixel camera, it has 2.5 megs of red sensors, 2.5 megs of blue and 5 megs of green. The computer then looks at the parts between the sensors to combine an R/G/B/G pixel to interpolate a colored image. It’s then filtered, processed and saved as single color pixel. The final image from my camera does roughly equal the amount of pixels available, but the pixels were determined from combining adjacent pixels together, not the individual pixels themselves.

BUT – let’s try this brain teaser. Instead of filtering the individual pixels for each picture, I put in a color filter for all of the pixels at once, taking 4 separate images (one red, one blue, one green and one with no color for detail)? My 10 mega-pixel camera would then have 40 mega-pixels available for each image! But it would require 4 different exposures as well as having to manually combine these images since this is a real odd-ball way of doing things. This is essentially how FITS files are delivered.

FITS formatted files are created with separate images for different colors. MOST of the time there is one each for Red, Green, Blue and “Luminescent” (a plain B/W image - where the detail is). Each of the separate images is B/W and it’s up to the user to combine and colorize them. You have to determine the amount of the colors and other issues. (We’ll cover this later on)

So what’s the point of this section? 1) JPEG images are compressed, 2) 10 mega-pixels ain’t necessarily 10 mega-pixels, and 3) FITS images are comprised of separate images for each color and for detail. But why?

Well, we need to move on to the bits because FITS files don’t stop here. Or you can go back to the home page.

**Caveat** - there’s waaaaaaaaaaay more to FITS files than I’ve let on here. One of its biggest advantages is a rather extensive “Meta-file”, where a TON of information is stored about how the image was obtained and processed. For this tutorial we’ll leave this (and other things) alone for now.