Image Compression
Read This
Raw vs Jpg
Raw vs Jpg
Information you need to know
Part One: Different File Types
When storing photos we can choose between an array of different file types. We are going to look at three different file types for this assessment.
File Type 1: BMP
A Bitmap file is an uncompressed raw image file. It is usually large and if it was 1920x1080 resolution then it would be around 6 Megabytes large. It is not compressed and it contains all of the information that was taken by the camera. Bitmap files are usually used for magazines or photos where the output demands full resolution prints. You would normally keep a BMP as a raw file as it allows you to make a lot of adjustments before compressing it. This is like keeping the negatives of photos that an older camera took. BMP or Raw files may not be able to be red by every device.
File Type 2: PNG.
PNG files use lossless compression to compress files. You will learn about lossless compression later. Lossless compress files are smaller and in a 6 Megabyte file they would probably compress down to 3 Megabytes. PNG files are usually used for Thumbnails or graphics files. PNG's really do sharp edges well.
File Type 3: JPG
JPG files are compressed using lossy compression and they can compress even further. The more you compress an image the worse it will look when compressed. A standard compressed image may go down to 1 Megabyte. This would mean that downloading the image or storing the image is a lot easier as it takes up less space. Normally under normal compression when displayed on a screen the human eye will not notice the compression. Fine edges such as letters often suffer when using JPGs. JPGs are used for TV's, websites and Facebook as they are small and can be read by almost every device.
File Type 1: BMP
A Bitmap file is an uncompressed raw image file. It is usually large and if it was 1920x1080 resolution then it would be around 6 Megabytes large. It is not compressed and it contains all of the information that was taken by the camera. Bitmap files are usually used for magazines or photos where the output demands full resolution prints. You would normally keep a BMP as a raw file as it allows you to make a lot of adjustments before compressing it. This is like keeping the negatives of photos that an older camera took. BMP or Raw files may not be able to be red by every device.
File Type 2: PNG.
PNG files use lossless compression to compress files. You will learn about lossless compression later. Lossless compress files are smaller and in a 6 Megabyte file they would probably compress down to 3 Megabytes. PNG files are usually used for Thumbnails or graphics files. PNG's really do sharp edges well.
File Type 3: JPG
JPG files are compressed using lossy compression and they can compress even further. The more you compress an image the worse it will look when compressed. A standard compressed image may go down to 1 Megabyte. This would mean that downloading the image or storing the image is a lot easier as it takes up less space. Normally under normal compression when displayed on a screen the human eye will not notice the compression. Fine edges such as letters often suffer when using JPGs. JPGs are used for TV's, websites and Facebook as they are small and can be read by almost every device.
Part 2 Raw uncompressed files are represented using bits
1.) An image is made up of many pixels of colour. A high resolution 1920x1080 picture will have around 2 million pixels of colour
3.) Each Pixel is made up of RGB. This is red green and blue values. This is what gives us our colour. Combing these colours together can make up any colour that we can think of
5.) Each of these values are made up of 8 1's and 0's which added together become a byte.
7.) For example if you had the plain colour red it would have the RGB value of 255, 0, 0. In binary this would look like 11111111 00000000 00000000.
|
2.) When we zoom right in we can see the individual pixels of colour. Pixels are squares and tv's and monitors use them to display images.
4.) Each of these numbers is assigned a numerical value that starts at 0 and can be as high as 255. Each of these colours can have 256 levels of brightness.
6.)Each 1 and 0 is referred to as a bit of information. using this method we can calculate different numbers.
Summary:
A picture is made of individual pixels. Each pixel is made up of RGB colour combination. Red Green and Blue are stored in different numeric values made up of numbers between 0-255. Each of these values are made up of 8 1's and 0's. This is called binary. Each 1 and 0 is a bit of information. |
Part 3 Lossless compression
Lossless compression lets the image be made smaller without any loss of the quality of the image when it is uncompressed.
On the right is an example from a run length encoding for a fax machine. The original image (top) shows stores every pixel much like a bitmap raw image does. From the photo underneath you can see that rather then recording every dot of black or white you simply record the number of squares of black vs the number of squares of white. so 000 111111111111 000 becomes 3 12 3 which uses a lot less characters. This allows a picture file to save all the information yet not lose information. Primary use: .PNG files are used mainly for graphics files where edges have to be displayed sharply. They are also used for thumbnails where the image can be smaller, clearer and sharper. Advantages: Compresses the image and losses no quality. Saves a lot of data when solid colours are used. Good sharp edges ideal for compressing to smaller images. Can save transparent Disadvantages: Not the best at saving space. For photos it isn't always super efficient. Not great for vivid amounts of colour. |
Part 4 Lossy Compression
In nature most colours move from one shade to another. If we take a look on the picture to the right we can see the skin of the model moving from one shade to another. We usually call this a gradient.
Even with the edge of the models face or hair there is a gradient at the edge going from light to dark. Jpg compression takes advantage of this by dividing images into blocks of 8 by 8 pixels - a total of 64 pixels. It then uses a compression algorithm which is based on a Discreet Cosine Transform. Which makes the block appear close to the original shading with a high resolution image. It looks the same as an uncompressed image while taking a fraction of the original size.
The user does not see the difference in a high resolution jpg file as the human eye cannot tell the difference apart. If however you were to enlarge the image you would see the distortion when you zoomed in. Primary use: .jpg files are very common and used for most picture files in web pages, digital displays (TV's, monitors) and normal sized printed photos. This is because they have a low storage space and are compatible with most systems. They can load quickly and can still be high resolution. Advantages: - Very low storage - Very Quick Download - The viewer generally will not be able to spot the difference if it is a photograph. - Can compress gradients and vivid colour very well. Disadvantages: - Sharp edges used in web graphics can look very poor as the gradient will not pick up edges very well. -When Images are blown up (made larger) the compression can be more obvious. They are not as suitable for graphics pictures. as the |
Part 5 Practical Application: What would be best when....
Original Photos
The original photos should be stored as RAW images. This might be in the original format. This is because it stores the most information possible for the image. It is harder to make adjustments after an image has been compressed and one may need to access them. TV Display at wedding or function
.JPG would be the best format to use for a digital display. The viewer would not notice any difference in compression and it would quickly load and you could store more pictures. The other advantage is that most devices can read and transmit .jpg images. Whereas some might struggle with raw images. Magazine
.JPG as the photograph is of standard size, high resolution .jpgs would be easier to work with as you might be working with a large amount of images. If they were compressed they would be easier to use. However, you may still want to use Raw files depending on print. If graphics where to be used then .png would be ideal for the sharp edges. Jpg compression would be noticeable because of the way that it compresses images. the edges appear more jagged. You may however wish to go with raw image files as they have greater access to the CMYK colour range for printing. Print can require a much better image quality then screens. Website - standard picture
For a photograph a .jpg image would be better to use. This would maintain the high level of quality yet dramatically reduce the size. This would in turn make it easier to download and store online. This would make the website load faster as the jpgs would be smaller over all. Viewers would not perceive a difference between .png or .jpg. A3 Poster
When photos are printed you would traditionally use a .jpg image. However when an image is blown up into a very large A3 size the lacking quality might become apparent. You might be able to see the 8x8 blocks of compression. Because of this the raw file format or .bmp file format might be better as it could also support CMYK. CMYK is used for printing etc. |
Fax Machine
On a fax machine it uses run length encoding with gray scale. Although it doesn't us .png this is how the fax machine can send an image without taking too much space. The image would be in poor quality, but this is why fax machines are best suited for business documents. Newsletter
.JPG as the photograph is of standard size, high resolution .jpgs would be easier to work with as you might be working with a large amount of images. If they were compressed they would be easier to use. However, you may still want to use Raw files depending on print. If graphics where to be used then .png would be ideal for the sharp edges. Jpg compression would be noticeable because of the way that it compresses images. the edges appear more jagged. You may however wish to go with raw image files as they have greater access to the CMYK colour range for printing. Print can require a much better image quality then screens. Website thumbnail
thumbnail images are very small and thus the .png compression would be better. Png works better with edges so a thumbnail would stand out more as it wouldn't need to have weird looking gradients for edges. The size would not matter to much as the size of the picture would be much smaller. Backups of photographs for future use
For future use a raw image file format would be best. Even though jpgs could store more photos, Raw images store more information. This would mean that for whatever purpose you wished to use the photo for it could be adapted for this. The only reason one would change this would be if there were space restrictions and in which case .JPGs would be used to reduce file size. |
Compression Quick Guide
Situation:
|
Solution:
|
Audio compression
Just as we use compression to reduce the size of our image files, we can use compression to lower the size of our audio files. There are many different types of audio compression encoding, like pictures these can be lossless (we reduce the size without losing any data) or lossy (we reduce the size by getting rid of unnecessary data). MP3 is a popular lossy audio compression format that uses various techniques to reduce the amount of data, whilst still managing to maintain quality of sound. Techniques that are used in MP3 are: compressing quieter sounds more than louder sounds, compressing (or getting rid of) sounds that are outside of the range of human hearing, reducing the number of samples that are taken per second, and reducing the amount of data for each sample. This results in music files that manage to retain high quality sound in a far smaller number of bits.
|