.png

Term side of the Card.
Topic: Graphics
Unit title: .png
Categories: Format
Explanation side of the Card

Explanation: The lossless image format that retains all the image data, ensuring no quality loss when compressed. It supports transparency and is commonly used for web graphics and images that require high-quality details.

Example

Wronghtml
<img src="sneaker-cutout.jpg" alt="Red sneaker"
  width="600" height="600">
Righthtml
<picture>
  <source srcset="sneaker-cutout.webp" type="image/webp">
  <img src="sneaker-cutout.png" alt="Red sneaker" width="600" height="600">
</picture>

A cutout needs transparency: PNG keeps it losslessly, and WebP keeps it at a smaller size.

Common mistakes

  • Using PNG for photos, making files several times larger than needed.
  • Exporting icons as PNG instead of SVG, so they blur when scaled.

Key points

  • PNG is used for images that need transparency or sharp edges, not photos.
  • Large PNGs are optimized or also offered as WebP or AVIF.

Interview questions

Is PNG lossless?

Yes. PNG compression never loses data, though tools may reduce colors to a palette before saving to make files smaller.

What is the difference between PNG-8 and PNG-24?

PNG-8 uses a palette of up to 256 colors and is smaller. PNG-24 stores full color, and PNG-32 adds an alpha channel.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy