Use WebP for delivery
WebP can encode images losslessly or with adjustable quality and often produces compact web assets. It is a practical choice for photographs, thumbnails and mixed-content images where download size matters.
Use PNG for exact graphics
PNG stores pixels losslessly and is a dependable choice for interface artwork, diagrams, screenshots and assets that may be edited repeatedly. Photographic PNG files can become very large.
Transparency is not the whole story
Both formats can preserve an alpha channel. Compare the actual output around soft shadows, gradients and small text rather than choosing only from the transparency requirement.
Remove unnecessary metadata
A new browser-canvas encoding can omit camera and location metadata from the source. Always inspect the converted image because color handling and animation are separate concerns.