Sub topic 10
Saving PNG: lossless compression and transparency
This chapter assumes you already know what layers are, how the Background layer differs from a normal layer, and the difference between lossy and lossless storage from the earlier chapters. It covers how PNG stores pixels, how Photoshop writes a PNG, and the errors that most often show up in the result.
What PNG stores
PNG (Portable Network Graphics) is a flat raster format with lossless compression. Photoshop flattens your layers into one image on save. The compression step then shrinks the file without changing any pixel value. If you open the PNG again, you get exactly the pixels that went in.
PNG keeps three things that JPEG cannot keep at the same time:
- Exact pixel values, with no compression artifacts.
- An alpha channel, which stores per-pixel transparency from fully transparent to fully opaque.
- An optional embedded color profile.
PNG does not keep layers, masks, smart objects, adjustment layers, or editable text. Treat it as a delivery format, never as your master file.
Lossless does not mean small
Lossless compression finds repeated patterns and encodes them compactly. It works very well on flat colors, sharp edges, and text, such as logos and interface graphics. It works poorly on photographs, where noise and gradients leave few repeated patterns. A photo saved as PNG is often several times larger than the same photo as a JPEG.
| Content | PNG result | JPEG result |
|---|---|---|
| Logo with flat colors | Small, sharp edges | Larger at the same visual quality, with ringing around edges |
| Screenshot with text | Small, crisp | Visible artifacts near letters |
| Photograph | Very large | Much smaller, minor loss |
| Anything needing transparency | Supported | Not supported |
How transparency reaches the file
Photoshop writes transparency to PNG only if the flattened image actually contains transparent pixels. Two things decide this.
- The Background layer. A layer named Background is locked and always opaque. If your document has one, the PNG will have no transparency, no matter what you do to the layers above it. To fix this, double-click the Background layer to convert it to a normal layer, then delete or hide the unwanted pixels.
- Visible layers. Hidden layers are not written to the PNG. Only what you can see at save time is flattened into the file.
The checkerboard pattern in the canvas means transparent pixels. If you see the checkerboard where you expect transparency, the PNG will have it too.
Partial transparency and edges
An 8-bit alpha channel has 256 levels. A soft shadow or an anti-aliased edge uses the in-between levels, so a PNG can show a smooth shadow on any page color. Edges that look fringed on a new background usually come from a matte, which is a color the edge pixels were blended with. This happens when you cut a subject out against white and then place it on a dark page. Remove the fringe in Photoshop with Layer > Matting > Defringe before saving, or rebuild the edge with a clean mask.
Saving a PNG from Photoshop
There are two routes, and they give different results.
Route 1: File > Save a Copy
Choose File > Save a Copy (or Save As in older workflows), pick PNG from the format list, and confirm. Photoshop then shows PNG Options. The key choices are:
- Compression. Smallest or Largest. Both are lossless and give identical pixels. The choice trades file size against save and open speed. Smaller files take slightly longer to write.
- Interlace. None or Interlaced. Interlacing lets a browser show a rough preview while loading. It usually makes the file larger and rarely helps today. Leave it on None.
The open document stays a PSD (or whatever it was). You get a PNG on disk, and your layered file remains your master.
Route 2: File > Export > Export As
Export As is designed for delivery. Choose PNG as the format and you also get:
- A Transparency checkbox, which turns the alpha channel on or off.
- A Smaller File (8-bit) option, which converts the image to a reduced palette of colors.
- A scale and resize control, including a pixel size, so you can produce 1x and 2x files from one document.
- Metadata options (None or Copyright and Contact Info) and a Convert to sRGB checkbox.
Export As leaves your document untouched and does not change its file name or title bar.
Smaller File (8-bit) and its trade-off
Full PNG-24 stores 8 bits for each of red, green, and blue, plus alpha. The Smaller File (8-bit) option builds an indexed palette of at most 256 colors. It works well for flat graphics with few colors. For gradients, shadows, or photographs, it causes visible banding, which means bands of flat color where a smooth transition should be. Check the preview before you accept it.
Color profile, color mode, and bit depth
PNG as Photoshop writes it is an RGB format. Keep these points in mind.
- Color mode. CMYK documents cannot be saved as PNG in the normal way. Convert to RGB first (Image > Mode > RGB Color). Colors may shift, so preview before converting.
- Embedded profile. Photoshop can embed your working profile, such as Adobe RGB, in the PNG. Many browsers and apps handle profiles correctly, but some tools ignore them and show the pixel values as sRGB. For web graphics, convert to sRGB, either with Edit > Convert to Profile or with Convert to sRGB in Export As.
- Bit depth. Standard PNG output from Photoshop is 8 bits per channel. A 16-bit document can be saved as 16-bit PNG through Save a Copy in some versions, but support is uneven in browsers and apps, and Export As produces 8-bit output. Convert to 8-bit (Image > Mode > 8 Bits/Channel) when the target is the web.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| PNG has a white or solid background | The Background layer is still present, or a white layer is visible | Convert Background to a layer, hide or delete the fill |
| Dark or light fringe around a cutout | Edge pixels blended with the old background color | Use Layer > Matting > Defringe, or refine the mask |
| Colors look dull in a browser | Document is in a wide-gamut profile and the viewer ignores it | Convert to sRGB before saving |
| File is huge | Photograph, or the image holds noise and gradients | Use JPEG for photos, or reduce pixel dimensions |
| Banding in gradients | Smaller File (8-bit) was enabled | Turn it off |
| PNG option is missing in Save a Copy | Document is CMYK or uses an unsupported mode | Convert to RGB or Grayscale |
| Layers gone after reopening | PNG is flat by design | Keep the PSD master and edit that |
Transparency in a quick check
You can confirm that a saved PNG has real transparency without leaving Photoshop. Open the PNG with File > Open. If the layer in the Layers panel is named Layer 0 (not Background) and the canvas shows a checkerboard in the empty areas, the alpha channel was saved. If the layer is named Background, the file has no transparency.
A repeatable workflow
- Build and keep the master as a layered PSD.
- Make sure the Background layer is converted if you need transparency.
- Set the document to RGB, 8 bits per channel, sRGB for web use.
- Use Export As for delivery sizes, or Save a Copy for a single plain file.
- Reopen the PNG or preview it on light and dark backgrounds.
- Keep the PSD. Never overwrite it with the PNG.
Exercise
You export a logo from Photoshop as a PNG and place it on a dark web page. It appears inside a white rectangle, and the logo edges have a light halo. Name the two causes and the fix for each.
Show answer
The white rectangle means the file has no transparency, most likely because the locked Background layer (or a visible white layer) is still in the document. Convert the Background to a normal layer, delete or hide the white fill, and export again with Transparency on. The light halo comes from edge pixels blended with the old white background (a matte). Remove it with Layer > Matting > Defringe or by refining the mask, then check the result on a dark background before delivering.
Exercise
A designer exports a product photograph as a PNG with Smaller File (8-bit) turned on. The file is smaller, but the soft background gradient shows bands. Why did this happen, and what would you do instead?
Show answer
Smaller File (8-bit) reduces the image to an indexed palette of at most 256 colors, which cannot hold the many close tones of a smooth gradient, so bands appear. Turn the option off to keep full 24-bit color. Because the photo has no transparency, a high-quality JPEG would also be a better and much smaller choice.