Problem Statement
Which image format supports transparency?
Explanation
PNG and GIF image formats support transparency. PNG supports full alpha channel transparency, which means each pixel can have varying levels of transparency from fully transparent to fully opaque. This makes PNG ideal for logos, icons, and images that need smooth transparent edges. GIF supports binary transparency, where each pixel is either fully transparent or fully opaque. GIF is commonly used for simple animations. JPG does not support transparency at all. When you need a transparent background, you must use PNG or GIF. PNG is generally preferred over GIF for static images with transparency because PNG offers better compression and image quality. WebP, a modern format, also supports transparency and provides better compression than PNG. Understanding which formats support transparency is important for choosing the right format for different use cases in web design.
Code Solution
SolutionRead Only
<!-- PNG with transparent background --> <img src="logo.png" alt="Company Logo"> <!-- GIF with transparency --> <img src="icon.gif" alt="Icon"> <!-- WebP with transparency (modern) --> <img src="graphic.webp" alt="Graphic"> <!-- JPG does NOT support transparency --> <img src="photo.jpg" alt="Photo with solid background">
