Sub topic 5
Handle Transparency and Flattening
Assume you know how to work with Photoshop layers, masks, and the Canvas Size dialog. Also assume you know the difference between raster pixels and transparent pixels. This chapter focuses on preserving or removing transparency when preparing an image for the web or social media.
Understand transparency
Transparency means that some pixels have no visible color. In Photoshop, a layer can contain transparent areas shown as a gray-and-white checkerboard. A layer mask can also hide pixels without deleting them.
The checkerboard is only a Photoshop preview. It is not part of the exported image. Whether transparency remains depends on the file format and export settings.
- PNG supports transparency and is useful for logos, icons, interface graphics, and cutout objects.
- WebP supports transparency and often produces smaller files than PNG.
- GIF supports one-bit transparency, so an area is either fully visible or fully transparent. It cannot represent smooth partial transparency well.
- JPEG does not support transparency. Transparent areas must be replaced with a color before export.
Flattening combines visible layers into one layer. Flattening can remove editable layer structure and can also replace transparent areas with a background color. You can flatten a copy for export while keeping the original layered Photoshop document unchanged.
Choose whether to preserve the alpha channel
An alpha channel stores the transparency value for each pixel. Before exporting, decide whether the destination needs it.
For a logo placed over different website backgrounds, preserve transparency. For a photograph used in a social post, use a solid background because JPEG and many social platforms expect a fully opaque image.
Inspect the document before exporting:
- Hide background layers and check whether the checkerboard appears around the subject.
- Look for soft edges, shadows, or reflections. These often use partial transparency.
- Turn on a temporary contrasting background layer. This reveals light or dark halos that may be hard to see against the checkerboard.
- Decide whether the final file should preserve the transparency or include the temporary background.
A transparent edge can look correct over one background and incorrect over another. A white fringe around a cutout usually means the edge pixels were created against white during an earlier edit.
Flatten safely
To create an opaque version without damaging the original:
- Save the layered document.
- Duplicate the document or save a new copy.
- Add a background layer at the bottom.
- Fill the background with the color required by the destination.
- Check the edges at 100% zoom.
- Export the copy as JPEG, PNG, or WebP.
The Flatten Image command merges all visible layers and discards hidden layers. It is quick, but it gives you less control than adding a deliberate background layer first. If you need to preserve the original layer structure, do not flatten the master document.
Check transparency in Export As
Open File > Export > Export As. Choose PNG or WebP when transparent pixels must remain. Keep transparency enabled if the dialog provides that option. Do not judge the result only against Photoshop's checkerboard. Open the exported file over both a light and a dark background.
If you choose JPEG, Photoshop must replace transparency with a background color. Set that color intentionally before exporting rather than accepting an accidental white or black background.
Verify the result
After export, check these points:
- The file opens correctly outside Photoshop.
- The dimensions match the destination.
- Transparent areas are still transparent when required.
- The edges have no unwanted halo.
- The file is opaque when the destination requires an opaque image.
- The file size is reasonable for its use.
Exercise
You need a logo that will appear over both dark and light website backgrounds. Which format and export approach should you use?
Show answer
Keep the logo's transparent pixels and export it as PNG or WebP with transparency enabled. Inspect it over light and dark backgrounds before publishing.