Examples of the differences in quality of the four image types Raspistill uses, Jpg, PNG, BMP & Gif
Raspistill is used to control the Raspberry Pi Camera Module to take photo's. By default Raspistill saves photo's in the Jpg image format as it is the only format that benifits from faster hardware processing also making it a good option for time lapse photography. The down side with the Jpg format is it uses compression to make the file size smaller which removes some of the detail from the image.
Other image formats available are PNG, BMP and Gif. Gif images use a maximum of 256 colours where as the other formats use millions of colours so a lot of colour detail is removed. PNG and BMP image formats do not use compression so keep a lot more colour detail JPG and Gif.
Photo taken in the JPG format
Command: raspistill -o testimage1.jpg
A Photo taken in the PNG format
Command: raspistill -e png -o testimage2.png
A photo taken in the BMP format
Command: raspistill -e bmp -o testimage3.bmp
A photo taken in the Gif format
Command: raspistill -e gif -o testimage4.gif
Though on the first look the top 3 images look very similar, if you look at the coloured discs at the bottom of the image there is more detail in the color shades, giving the shape a better definition.
Zooming in to a region of the pictures you can see that the PNG and BMP photo's have better detail than the Jpg image.
As always how you use the camera is trade off between speed and quality. If you need fast processing and small file sizes then JPG images are the better option. If you want as much detail as possable maintained then PNG or BMP are the better option. Though PNG would be the better choice of the two as it generates smaller files than BMP images. The full PNG image is 7.5mb where as the full BMP image is 15.1mb in size.
As mentioned above Jpg images use compression that removes more detail with higher compression but generates a smaller file size. These images show the differences in the quality.
The stated file size is for the full 5 mega pixel version of these images which these images are cropped from.
Jpg image at 100% quality
Command: raspistill -q 100 -o testimage1.jpg
(The default quality is 100% so -q 100 is not required to be entered in the command)
File Size 2.54 mb
Jpg image at 75% quality
Command: raspistill -q 75 -o testimage2.jpg
File Size 2.45 mb
Jpg image at 50% quality
Command: raspistill -q 50 -o testimage3.jpg
File Size 2.04 mb
Jpg image at 25% quality
Command: raspistill -q 25 -o testimage1.jpg
File Size 1.14 mb
If image quality is most important to you then you may want to consider using raspiyuv which saves images in the raw image format, but you will need specialised software or more advanced image editing software to load and use these images normally.