There are a number of file types available for saving out rendered images. The most important aspect of any image file format is to understand the information it can hold and the quality it can produce. Some image file formats offer better compression, where as others can hold more colour information and extra channels such as alpha but at the cost of a larger file size. As each file format is different and choosing the correct one to use for your render is key.
What makes a digital image?
Firstly an image is made from bits. One bit is a binary digit which is 0 or 1 and represents a flip flop action that can be on or off. For displaying an image it would be black (0) or white (255). In order to allow for a much wider range of colours, more bits are introduced. In the early stages of computing 8-bit became the standard for image files, this allowed for 256 different combinations of 1 and 0 (2 to the power of 8). This type of calculation is known as an integer.
Take a 1600 x 1200 pixel sized image, that is 1,920,000 pixels in total which when rounded up is a 2 Mega Pixel image (a megapixel is 1,000,000 pixels). Each pixel is made up of a mixture of the three primary colours, red, green and blue. These are referred to as colour channels. Each primary colour channel is made up of a bit depth which determines the range of colours that are available per pixel.
Earlier I mentioned a typical image has 8-bit, this means that red, green and blue can each have 8-bit totalling 24-bit per pixel. That is a total of 256 available colours for each channel. When all three primary colours are combined there are 16.7 million colours (256 x 256 x 256) per pixel. This is known as true colour.
There are file formats that allow for much more variations in colour, this is due to the increase in the maximum bits per channel.
16-bit per channel images
16-bit per channel images have an optional channel known as alpha transparency. So that’s 16-bit per RGB and now A. That’s 2 to the power of 16 = 65,536 available colours per channel. When all three primary colours are combined there are 281 trillion colours (65,536 x 65,536 x 65,536) per pixel. With alpha transparency it would be 64-bit per pixel. This is known as high colour.
16-bit images are already at 281 trillion colours. The next logical step would be to go to 32-bit per channel images. However if you were to use the same integer rule, the resulting number of colours would be too large. The solution was to introduce a method known as floating point. That allows 1-bit to float meaning there are no fixed number of digits before and after the decimal point. As a result it can handle a larger range of numbers and the colours can go beyond the integer range of 0 – 255 (pure black – pure white).
There are also 16-bit image formats that use floating point. Known as half float and they are not to be confused with the normal 16-bit per channel high colour images. 16-bit per channel half float images use the same rule as 32-bit per channel full float images but at a much smaller scale.
Common image formats
Certainly within 3d visualisation there are image formats more commonly used over others due to their properties. It is important to understand which image file format is 8-bit, 16-bit and 32-bit, especially when compositing. In addition to colour channels some image file formats use compression which can reduce the quality of your final render.
JPEG – 8-bit per channel with lossy compression. This means that certain similar pixels are merged together and then some are discarded. The image is re-sampled onto a smaller range of colours, whilst still maintaining that it is an 8-bit image when in fact it would be a lot less. This allows for much smaller file sizes but it is not good for compositing.
PNG – This image file format can be saved as either an 8-bit or 16-bit per channel image. However within 3ds Max they are shown as RGB 24-bit and RGB 48-bit, which is bit per pixel, it can get confusing some times between bit per channel and bit per pixel. If you open them up in Adobe Photoshop you will notice that they are only 8-bit or 16-bit per channels. If you tick alpha channel upon saving then each would become 32-bit and 64-bit per pixel. A PNG has Lossless compression. When saving, the image is compressed and upon opening the image becomes un-compressed without losing any data. This is similar to how a ZIP file works. Less storage is needed for the file when it is not being used.
Targa – These can be saved in 16-bit, 24-bit or 32-bit per pixel. 16-bit per pixel means that there is only 5-bit per RGB channel with 1 remaining un-used bit. This allows for 4,096 colours and the result is very low quality. 24-bit has 8 bit per channel and 32-bit has 8 bit per channel with 8 bit left for alpha transparency. This would allow for a total of 16.7 million colours, which is the same as an 8-bit per channel JPEG with the added functionality of an alpha channel. Targa files can be stored RAW or with lossless compression.
TIF – This image file format can be considered the most used, it offers 8-bit colour and 16-bit colour per channel as well as 16-bit and 32-bit LogL and LogLUV. LogL and LogLUV are different methods for storing high dynamic range data, similar to the HDRI and its floating point algorithm. TIF files instead use a different colour space to RGB known as CIELUV. 16-bit and 32-bit floating point images are usually large in file size, however due to their different algorithm, TIF files are much smaller in file size.
HDR – A 32-bit per channel full float image format that can store a high dynamic range of colours. These file formats are commonly used for image based lighting. HDR files use Run-length encoding (RLE) which is a lossless compression.
OpenEXR – This can be 16-bit per channel (half float) or 32-bit per channel (full float). The advantage over using EXR instead of HDR is the ability to store an alpha channel as well as any other available channels, useful for compositing. EXR files in contrast have no compression so the colour fidelity is much higher than HDR, but the file sizes are very large. Usually 16-bit per channel EXR files are adequate for compositing. 32-bit per channel could become un-manageable. EXR files can also be used for image based lighting, however there may be little difference between using HDR and EXR, so most favour HDR due to its smaller file size.