Sub topic 5
Layers and flattening: what a flat file loses
This chapter assumes you know the Photoshop workspace, what pixels and resolution are, and that a document is built from stacked layers. It explains what flattening does, which formats force it, and what you cannot recover afterward.
What a layered document stores
A Photoshop document is a stack of layers plus the information that describes how they combine. The Layers panel shows only part of that information. A layered file can hold these items:
- Pixel layers: ordinary raster content, each with its own pixels and transparency.
- Layer masks and vector masks: grayscale or path data that hides parts of a layer without erasing pixels.
- Adjustment layers: non-destructive color and tone edits, such as Curves or Hue/Saturation, applied to the layers beneath them.
- Smart objects: layers that embed source content, so you can scale or filter them repeatedly without losing quality.
- Type layers and shape layers: text and vector shapes that stay editable.
- Layer styles and blend modes: effects such as drop shadows, plus the opacity and blending settings for each layer.
- Groups, names, and layer comps: the organization that makes a large file manageable.
All of this is edit-time information. The final picture you see on screen is called the composite. It is the single image you get when Photoshop combines every visible layer from bottom to top.
What flattening does
Flattening merges all visible layers into one pixel layer, called the Background layer. Photoshop calculates the composite once and stores only that result. The original structure is discarded.
The consequences are concrete:
- Each layer's pixels are blended into one set of pixels. You can no longer move, recolor, or delete a single element on its own.
- Masks are applied, not kept. Areas a mask hid are permanently gone.
- Adjustment layers are baked in. You cannot lower the Curves strength afterward.
- Text becomes pixels. You cannot fix a typo; you have to repaint the letters.
- Smart objects are rasterized to their displayed size. If you scale the flat image up, it softens, because the original source data is gone.
- Hidden layers are discarded. When you flatten, Photoshop asks whether to discard hidden layers. If you agree, content you had switched off is deleted.
To flatten manually, choose Layer > Flatten Image. To merge only part of the stack, use Layer > Merge Visible or Merge Down. Merge Visible leaves hidden layers in place, so it is safer when you want to keep some of them.
Flattening happens implicitly when you save
Often you never choose Flatten Image. Photoshop flattens for you when you pick a format that cannot store layers. The table shows what each format keeps.
| Format | Stores layers | Stores transparency | Stores masks and smart objects | Compression |
|---|---|---|---|---|
| PSD | Yes | Yes | Yes | Lossless |
| JPEG | No | No | No | Lossy |
| PNG | No | Yes | No | Lossless |
The details differ by format:
- PSD keeps the whole structure. It is the only one of the three that you can reopen and continue editing exactly where you left off.
- JPEG stores one flat, opaque image. Transparent areas are filled with a matte color (white by default), because JPEG has no transparency channel. It also discards some image detail to make the file smaller, so it is a flat file with an additional loss.
- PNG also stores one flat image, but it can keep transparent pixels. Flattening for PNG therefore merges layers while leaving empty areas transparent, rather than filling them with a color. The format is lossless, so the pixels you see are the pixels stored.
Later chapters cover each format's save options in detail. Here the point is the difference in what is lost.
A flat file is not a lossy file
Two losses are easy to confuse, so keep them separate.
- Structural loss comes from flattening. You lose layers, masks, text, and so on. It affects editability, and it happens with PNG as well as JPEG.
- Pixel loss comes from lossy compression. JPEG discards detail, and each resave adds more. PNG does not.
A flattened PNG has structural loss but no pixel loss. A JPEG has both. A PSD has neither. When someone asks whether they can "get the layers back" from a PNG, the answer is no, even though the PNG looks perfect.
How Photoshop warns you
When you use File > Save As and choose JPEG, Photoshop usually shows the Layers option greyed out or unchecked, and a warning icon may appear next to "As a Copy." In many versions you will also see the message that the file must be flattened to save in that format. Treat that as a signal.
Photoshop typically flattens a temporary version for the save, not the document you have open. So your open document still has its layers. This is why the "Save a Copy" behavior matters: the file on disk is flat, but your working document is not. The danger comes later. If you close the document without saving a PSD, the layered version exists nowhere.
You can check what a document currently holds by looking at the Layers panel. A single locked layer named Background usually means the image is flat. The title bar tab also shows the color mode and bit depth, but not the layer count, so use the panel.
Keeping layers while still delivering a flat file
The standard workflow separates the master from the deliverable:
- Build and save the master as
name.psdwith layers intact. - Create the deliverable by saving a copy or exporting it as JPEG or PNG.
- Keep working in the PSD. Re-export whenever the design changes.
If you must flatten the open document, for example to run a filter on the whole image, do it as a step you can undo. Use Edit > Undo immediately, or take a snapshot in the History panel first. History is cleared when you close the document, so it is not a long-term safety net.
Another safer option is to stamp a merged copy without destroying the stack. Press Ctrl+Alt+Shift+E (Windows) or Cmd+Option+Shift+E (macOS) to create a new layer containing the merged result of all visible layers, placed on top. The originals stay underneath.
Edge cases
- Hidden layers and flattening. Flatten Image prompts about hidden layers. If you answer yes, they are deleted. If you plan to reuse them, say no and instead hide nothing you still need, or save the PSD first.
- Blend modes and the Background layer. A layer with a blend mode set to something other than Normal blends with what is below it. When the bottom layer is transparent, results can differ from what you expect after flattening onto white. Check the flattened preview.
- Transparency in JPEG. If your design has a transparent background and you save a JPEG, the transparent areas become the matte color. A logo meant for a dark page will then show a white box. Use PNG for that case.
- Color mode. Flattening does not change color mode, but the target format might. Saving a CMYK file as PNG for the web usually needs conversion to RGB first. The color profile chapter explains this.
- Very large documents. Layered files can be many times larger than their flat versions. That size is the cost of the editable structure.
- Linked smart objects. A linked smart object points to an external file. Flattening bakes in the displayed result, and the link is gone from the flat file.
Exercise
You finish a poster with 40 layers, including text and a logo on a transparent background. A colleague wants the logo as a transparent web graphic and the poster as a small photo-style file. Name the format for each, and state what you must keep to change the poster text next month.
Show answer
Use PNG for the logo, because it is lossless and keeps transparency. Use JPEG for the poster, because it is a flat opaque image and compresses to a small size. Both are flat, so neither can be edited as layers. To change the poster text next month you must keep the layered PSD master, because the text layers exist only there. Re-export the JPEG from the PSD after editing.
Exercise
A JPEG and a PNG are both saved from the same layered document. Which one has structural loss, which one has pixel loss, and which one has both?
Show answer
Both files have structural loss, because neither can store layers, masks, or editable text. Only the JPEG has pixel loss, because it uses lossy compression. So the JPEG has both kinds of loss, and the PNG has structural loss only.