Never bothered to think about this aspect until today, when the choice of the format made a ton of the difference to the output!

Via C# Corner :

First off, why use PNG instead of GIF? Probably the most important reason is that GIF supports a maximum of 256 colors. The second reason is Unisys has a lockdown on the rights to LZW compression which the GIF format can, and usually does use. PNG overcomes the color depth hurdle by providing up to 48Bpp (bits per pixel). Just as importantly, the PNG format is patent-free and available for use by anyone.

PNG has other advantages over GIF as well:

  • Alpha Channels: GIF supports binary transparency, that is a pixel can either be opaque or transparent. PNG allows full variable transparency with 254 levels of partial transparency. I should also say that it is also possible to obtain 65,534 levels of transparency, but that is out scope for web graphics.
  • Gamma Correction: This allows authors the ability to correct the differences in an image that arise from being viewed by different monitors. Most notably is the difference between PC and Macintosh.
  • Two Dimensional Interlacing: Also known as Progressive Scan. While GIF does support this, PNG allows a better representation of the image to displayed as the data is transferred.