What is GIF?
Thirty-five years old and still everywhere, because it does one thing nothing else quite does: animate inline, silently, in any context that displays an image. The cost is a 256-colour palette and no real motion compression, which makes GIF a poor way to store video and an excellent way to send a three-second loop.
What is PNG?
PNG is the web's lossless image format. It compresses without ever degrading the picture and has a real alpha channel, which is why screenshots, logos, line art and anything with sharp edges or text belong in it. The trade is size: on a photograph, PNG is enormous compared to JPG.