Sub topic 10
Saving PNG: Lossless Compression and Transparency
Prerequisites
You should understand Photoshop layers, pixel dimensions, and the difference between a working document and a delivered image. This chapter assumes you can open a document and identify whether its canvas contains transparent areas.
What PNG preserves
PNG uses lossless compression. Lossless means that Photoshop can compress the file without discarding pixel values. When the PNG is reopened, its stored pixels match the pixels that were saved.
PNG is useful for interface graphics, diagrams, screenshots, and logos. It is usually less suitable than JPEG for large photographs because PNG files can be much larger.
A PNG stores the visible composite image, not Photoshop's editable layer structure. Before saving, Photoshop renders the layers into one image. The original PSD remains editable, but the PNG does not retain separate layers, layer masks, adjustment layers, or smart objects.
| PNG feature | What it preserves | Important limitation |
|---|---|---|
| Lossless pixels | Exact saved pixel values | Does not preserve Photoshop layers |
| Transparency | Partial or complete transparent areas | Transparency is not available in every PNG color mode |
| RGB or grayscale color | Color channels and, when supported, a profile | Opening software may interpret profiles differently |
| PNG-8 or PNG-24/32 output | Smaller or richer color data | PNG-8 has fewer colors and less transparency precision |
Transparency and alpha
Transparency is stored as an alpha channel. An alpha value describes how much of a pixel is visible:
- An alpha value of 0 is fully transparent.
- An alpha value of 255 is fully opaque in an 8-bit channel.
- Values between them create semitransparent edges and shadows.
The checkerboard pattern in Photoshop is a display for transparency. It is not saved as part of the image. If you see a solid background layer, the PNG will contain that background unless you hide or remove it before saving.
For clean transparency, check the edges at high zoom. A logo may have semitransparent anti-aliased pixels around its outline. These pixels blend correctly over many backgrounds, but a matte-colored edge can appear if the artwork was created against a solid background.
Saving a transparent PNG
Use File > Save a Copy when you want to create a PNG delivery file while keeping the PSD as the active working document. In Export As, choose PNG when you need to scale the image or select web-oriented export settings.
Before saving:
- Hide or delete any background layer that should be transparent.
- Confirm that the document uses RGB or grayscale mode.
- Inspect the image at 100% zoom.
- Choose PNG-24 or PNG-32 when full color and smooth transparency matter.
- Use PNG-8 only when a limited color palette and smaller file are acceptable.
This ExtendScript example saves a PNG copy of the active document:
// ExtendScript: save a PNG copy of the active document
var doc = app.activeDocument;
var pngOptions = new PNGSaveOptions();
pngOptions.interlaced = false;
doc.saveAs(
new File("~/Desktop/logo.png"),
pngOptions,
true,
Extension.LOWERCASE
);The true argument saves as a copy, so the open document does not become the PNG file. Keep the PSD as the master document.
> callout tip > PNG compression is lossless, but a PNG can still look different if Photoshop resized it, converted its color mode, or exported it with fewer colors.
Exercise
Exercise
You need a logo with smooth semitransparent edges for placement on both light and dark web pages. Which format and preparation should you choose?
Show answer
Keep the layered PSD as the master, hide the solid background, inspect the edges, and export an RGB PNG-24 or PNG-32 with transparency.