Sic pretty much nails it.
I'd just clarify the jpg vs png/gif point though:
gif/png for images with large areas of flat colour
jpg for intricately detailed, many coloured images (photos are indeed the most obvious case, but there are others times I'd use jpg too)