When PNG is the right target
PNG uses lossless DEFLATE compression and supports a full alpha channel. That makes it the standard choice for graphics with transparency, text and hard edges, and for any image you plan to edit and re-save, because each save is an exact copy.
For photographs that only need to be viewed or shared, JPG is usually the better choice because the file is far smaller.