Sub topic 4
Choose a format: JPEG, PNG, GIF, SVG, or WebP
This chapter assumes you can work with layers and the canvas in Photoshop, know the difference between pixels and print units, and understand what a raster image and transparency are. You have also set the pixel dimensions and converted to sRGB, which earlier chapters cover. Here you pick the file format that fits the image's content and destination.
What a format decides
A file format decides four things about an exported image:
- How the pixels are compressed, either lossy (some detail is discarded for good) or lossless (every pixel is kept).
- Whether the file can hold transparency.
- How many colors it can hold.
- Whether it can animate.
No format is best at all four. Your job is to match the image's content to the format that handles it cheaply.
| Format | Compression | Transparency | Animation | Best for |
|---|---|---|---|---|
| JPEG | Lossy | No | No | Photos, gradients, soft images |
| PNG | Lossless | Yes, with partial opacity | No (APNG is rare) | Screenshots, logos, UI, sharp edges |
| GIF | Lossless, 256 colors | On or off only | Yes | Short, simple animations |
| SVG | Vector, not pixels | Yes | Possible in code | Icons, logos, simple illustrations |
| WebP | Lossy or lossless | Yes | Yes | General replacement for JPEG and PNG |
JPEG: photos and smooth tones
JPEG is a lossy format. It splits the image into small blocks and throws away detail the eye notices least. This works very well on photographs, where colors shift gradually, and produces small files.
Its weaknesses show up on hard edges. Text, thin lines, and flat color next to flat color develop fuzzy halos called compression artifacts. JPEG also cannot store transparency. Transparent areas are filled with a matte color, usually white, when you export.
Each re-save of a JPEG loses more detail. Keep your PSD as the master and export from it. Never edit an exported JPEG and save it again as your working file.
In the file names for Generate Image Assets, the quality goes after the extension, as in hero.jpg90%. The next chapters cover quality in more detail.
PNG: sharp edges and transparency
PNG is lossless, so every pixel survives. It supports a full alpha channel, which means each pixel can be anywhere from fully transparent to fully opaque. This makes smooth, anti-aliased edges over any background.
Photoshop offers two PNG variants:
- PNG-24 (24-bit color plus alpha) keeps millions of colors. It is the default choice.
- PNG-8 limits the image to a palette of up to 256 colors. Files are much smaller, but gradients can show visible banding, which is a stripe pattern where smooth shading breaks into steps.
PNG files of photographs are large. A photo that is 300 KB as a JPEG can easily be over 1 MB as a PNG, with no visible gain. Use PNG when the image has flat colors, text, or transparency.
GIF: animation with limits
GIF stores at most 256 colors per frame and only one level of transparency: a pixel is either fully see-through or fully opaque. Edges therefore look jagged against backgrounds different from the one you designed on.
GIF remains useful because it is accepted nearly everywhere, including email clients and chat tools, and because it animates. For a still image, PNG-8 is almost always better. For long or photographic animation, GIF files grow very large, and a short video or an animated WebP is a better fit.
Photoshop can export animations from the timeline using File > Export > Save for Web (Legacy) with GIF selected. Chapter 13 returns to that dialog.
SVG: vector shapes that scale
SVG is a text-based vector format. It stores shapes and paths as instructions, so it stays sharp at any size and the file stays tiny for simple graphics. It is ideal for logos and icons.
Photoshop is a raster editor, so SVG support has limits:
- Photoshop can export a layer as SVG through Export As, but only when the layer is made of vector content, such as shape layers. Pixel layers and photographs are not converted into clean vector paths.
- Effects such as blur, complex layer styles, and blend modes may not carry over. Check the result in a browser.
- If you design icons often, a vector tool such as Illustrator is more reliable.
Because SVG is code, an SVG from an untrusted source can contain scripts. When you place SVGs from others on a site, treat them as code to be reviewed.
WebP: the modern all-rounder
WebP supports lossy compression (like JPEG), lossless compression (like PNG), alpha transparency, and animation, in one format. Files are typically noticeably smaller than the JPEG or PNG equivalent at similar visual quality.
Current Photoshop can export WebP, either from Export As or by saving with the WebP plug-in built into recent versions. Browser support is now broad across current browsers. Support is weaker in older software, some email clients, and some social platforms, which may re-encode or reject WebP uploads.
A common pattern for websites is to serve WebP and keep a JPEG or PNG fallback for places that do not support it. The HTML element picture can do this, but that is outside this chapter's scope.
How to decide
Work through these questions in order:
- Is it a simple icon or logo made of shapes? Use SVG if the layer is a true vector shape and the destination accepts SVG.
- Does it need to move? Use animated WebP or a video for quality. Use GIF when the destination only accepts GIF.
- Does it need transparency? Use PNG or WebP. Do not use JPEG.
- Is it a photo or has smooth gradients? Use JPEG or lossy WebP.
- Is it text, a screenshot, or a flat-color graphic? Use PNG, or lossless WebP.
- Does the destination restrict formats? Follow its rules. Many social platforms accept JPEG and PNG reliably and may convert everything else.
Common errors
- Exporting a photo as PNG. The file is several times larger than needed. Switch to JPEG or lossy WebP.
- Exporting a logo or screenshot as JPEG. Edges look smudged. Use PNG or lossless WebP.
- Expecting transparency from JPEG. The area becomes a solid matte color. If the background should show through, choose PNG or WebP.
- Using GIF for a still image. You get 256 colors and jagged edges for no benefit. Use PNG-8 if you need a small palette.
- Assuming an SVG will match the layer. Open the exported SVG in a browser and compare it to the document.
- Sending WebP to a platform that rejects it. Check the platform's accepted formats, and fall back to JPEG or PNG.
Choosing the format in the tools
In Export As, the Format menu lists the formats available, and the extension in the file name follows from it. In Generate Image Assets, the extension on the layer name sets the format, and these names show the pattern:
hero.jpg90%
icon-search.png
icon-search-2x.png
200% badge.png
300x300 avatar.jpgHere hero.jpg90% exports a JPEG at 90% quality, icon-search.png exports a PNG, and 200% badge.png exports a PNG at twice the scale. The size prefix is covered in the chapter on scales and assets.
Exercise
You have three images to export: (a) a product photo on a gray studio background, (b) a company logo built from shape layers that must stay sharp on a high-density screen, and (c) a screenshot with small text and a transparent drop shadow. Which format would you choose for each, and why?
Show answer
(a) JPEG, or lossy WebP, because it is a photograph with smooth tones and no transparency, and lossy compression gives a small file. (b) SVG, because the logo is vector shapes and scales to any density; export as PNG at 2x only if SVG is not accepted or does not render correctly. (c) PNG, or lossless WebP, because the text needs lossless compression to stay crisp and the drop shadow needs partial transparency, which JPEG cannot store and GIF cannot render smoothly.
Exercise
A designer exports a transparent logo as JPEG and the logo appears on a white rectangle on a dark web page. What went wrong, and how do you fix it?
Show answer
JPEG has no alpha channel, so Photoshop filled the transparent pixels with a matte color, white in this case. Export the logo as PNG or WebP, which keep transparency, or as SVG if the logo is vector. Then check the file on a dark background to confirm the edges look clean.