Image file formats come in lots of flavours to accomodate everyone - from simple raw data storage (array of red, green blue) to the more complex which include compression and animation information (like jpgs and gifs).
The following links provide both explanation and practical code examples for common image formats:
• Bitmap(.bmp) - old faithful - one of the simplest but also powerful image formats (allows a mixture of resolutions)
• JPEG(.jpg) - even today - the image format of the internet - due to its amazing ability to compress images! You can have a photo of 4+Mb shrunk down to a few hundred kb! Wow!
• DirectX DDS - the famous graphics API has to have its own file format (fast loading and special features for games/high performance graphics/visualizations)
• Flash SWF - while technically not an image format - it does contain images (vectorized data and jpgs)
• PNG(.png) - images with transparency and a mixture of features (including compression)
• GIF(.gif) - when images need to have simple animations (or color tables)
• WebP (.webp) - one of the new kids on the block - a new image format for the web