Image to Layers

Unflatten an Image: Turn a Flat PNG or JPG Back into Layers

A saved flat image cannot be unflattened, because its layers are gone. Here is what still works: Undo before closing, a manual rebuild, or an AI layer split.

On this page7 sections
Short answer

You cannot reverse a flatten once the file is saved and closed: flattening merges every visible layer into one and throws the rest away, so the layers are no longer in the file. What you can do is rebuild them, by hand in an editor or with an AI tool that splits the flat image into named, transparent layers over a filled background.

Still open in Photoshop?Undo, or step back in the History panel, before you close the document.
Already saved as PNG, JPG or a flattened PSD?Look for a layered copy first, then rebuild.

What flattening actually does to a file

In Photoshop, Layer > Flatten Image merges all visible layers into a single Background layer, discards hidden layers and fills any transparent areas with white. Adobe calls it permanent and recommends saving a copy of the layered file first (Adobe Help: Flatten layers in an image).

Exporting has the same effect on the copy you export. A JPG has no place to keep layers, and the PNG specification says that every PNG holds a single static image (W3C PNG Specification, section 4.1). So whether the file was flattened on purpose, exported for the web, or downloaded from an AI image generator, what you hold is one grid of pixels. Nothing inside it records where the headline ends and the background begins, or what sat behind the product.

That is why “unflatten” is really a rebuild. The pieces have to be found, cut out and placed on new layers, and the holes they leave have to be filled.

Can Photoshop unflatten an image?

Only while the document is still open in the session where you flattened it.

  • Undo: Ctrl+Z (Windows) or Command+Z (macOS) steps back through recent actions, flatten included (Adobe Help: Use Undo and Redo commands).
  • History panel: click a state above Flatten Image to return to the layered version. Adobe notes that closing the document clears all history states and snapshots (Adobe Help: History panel settings).
  • File > Revert: goes back to the last saved version. If you saved after flattening, the last saved version is the flat one.

Once the flattened file is saved and closed, reopening it gives you one Background layer and no history. No setting brings the old layers back, because they are not stored anywhere in that file.

1Rebuild the layers by hand

In Photoshop, GIMP or Photopea, select each front element, move it to its own layer with Layer > New > Layer Via Cut (Adobe Help: Create layers), fill the gap behind it with Content-Aware Fill or Generative Fill, and paint or clone any covered parts from front to back before saving as PSD. For the full walkthrough and the tools for each step, see how to separate an image into layers: Photoshop vs AI.

Two things make a hand rebuild slow on a typical export. Text has to be selected cleanly around every letter or retyped in a matching font, and every element you lift leaves a hole that needs filling.

2Rebuild the layers with an AI split

An AI layer tool does the same jobs in one run: it finds each element, cuts it from your pixels onto a transparent layer, completes parts that were covered and fills in the background.

Here is the sneaker sale banner from our examples, a flat 2,560 × 1,440 JPG. Treat it as the file someone flattened and sent you:

A flat sneaker sale banner: the STRIDE logo, the headline SUMMER SALE, a red 40% OFF badge, a black Shop Now button and two white sneakers with orange trim on a mint green background
The flat original. The front sneaker covers the toe and laces of the rear one.

The front shoe is the interesting part. In the flat file, the rear shoe’s toe and laces simply do not exist; they were never drawn, or they were merged away. A useful rebuild has to give you a rear shoe you can move on its own, which means completing it.

LayerSplit returned seven named layers, listed here front to back, over a filled background:

Foreground Sneaker
Foreground Sneakerobject layer
Red 40% OFF Badge
Red 40% OFF Badgegraphic layer
Shop Now Button
Shop Now Buttonbutton and label together
Headline Text SALE
Headline Text SALEtext, kept as pixels
Headline Text SUMMER
Headline Text SUMMERtext, kept as pixels
STRIDE Logo Text
STRIDE Logo Textlogo, kept as pixels
Background Sneaker
Background Sneakertoe and laces completed
Background
Backgroundfilled in, free
2,560 × 1,440source image
7 layersplus free background
Covered partsrear sneaker restored
~1 mintypical run time

Because one shoe covered the other, AI separates the front elements and generates a complete rear shoe. Hide the Foreground Sneaker layer and you can see what was rebuilt behind it:

OriginalOriginal
Front shoe hiddenFront shoe hidden
Front shoe layer hidden. The rear shoe’s toe and laces, and the mint background behind the front shoe, were completed by AI.

Look closely before you reuse that rear shoe on its own. Each separated layer is redrawn by AI from your image, so fine details and the completed toe can differ slightly from a photo of the actual shoe. The same goes for the filled background where the shoes stood, which can keep a faint trace of the soft shadow that sat under them.

You can download the result as one layer at a time (PNG), all layers as a ZIP with a layers.json file listing each name, position and size, or a layered PSD. The PSD opens in Photoshop, and in free editors such as Photopea; to look through the layers before editing, the free PSD viewer shows them in the browser.

Flatten vs unflatten, side by side

Flatten Unflatten (rebuild)
What it is One command that merges layers A reconstruction from the flat pixels
Undo Only with Undo or History before closing Nothing to undo; the flat original stays as it was
Layer names Lost You name them, or an AI split names them by content
Hidden layers and effects Discarded Not recovered; only what was visible can be rebuilt
Area behind each element Merged away Filled in, by hand or by AI
Text Merged into pixels Pixels by default; retype or use an editable-text export

What a rebuilt file can and cannot give back

A rebuild gives you working layers, not the original file.

Not the original structure: hidden layers, masks, layer effects, smart objects and adjustment layers were discarded by the flatten and do not come back. You get plain pixel layers.
Text is editable for clean lines: Download PSD writes readable headlines as Photoshop type layers using matched open-source Google Fonts (with optional system-font fallback and free browser Quick Type editing), while stylized logos and multi-colour graphics remain pixel layers.
Layers are AI-redrawn: each layer, any hidden parts behind overlapping elements, and the filled background are redrawn by AI from your image, so small details can differ. Check those areas before you reuse them.
Size: output is up to 2,560 px on the long side, and larger uploads are scaled down first. Fine for web and social, not for large print.
Photos: busy real-world photos split less cleanly than designed images such as posts, banners and illustrations.
Shadows and glows: strong cast shadows can stay in the background or become their own layer, and glowing outlines keep a faint halo.

If what you need is just one subject on a transparent background, a background remover is enough; see layer separation vs background removal for when each makes sense. If the flat file is a PNG or JPG you want as a PSD, the PNG to PSD and JPG to PSD pages also make a free one-layer PSD in the browser, which is useful when you only need the file format, not separate layers.

Rebuild the layers of your flat image

Upload the flattened PNG, JPG or WebP (up to 20 MB) and check each layer before you download. Sign in with Google for 10 free credits, enough for One element, and check in daily for more, no card needed.

Split an image ->

FAQ

Can you unflatten an image in Photoshop?

Only before you close the document. Undo (Ctrl+Z or Command+Z) or a History panel state above Flatten Image returns the layered version, but closing the document clears all history states. After that, the layers have to be rebuilt by hand or with an AI layer tool.

Can I unflatten a flattened PNG?

Not directly, because a PNG holds a single image and keeps no layer data. You can rebuild layers from it: cut each element onto its own layer and fill the background behind it, by hand or with an AI split that does both in one run.

What is the difference between flatten and unflatten?

Flatten is a single command that merges all visible layers into one and discards hidden ones. Unflatten is not a command at all; it means rebuilding separate layers from the flat result, which recovers what was visible but not the original layer names, effects or hidden layers.

Does saving as JPG flatten my PSD?

The JPG you save is flat, because the JPG format has no layers. Your PSD keeps its layers as long as you save the JPG as a copy and do not flatten and save over the PSD itself.

Will an AI split recover my original layers?

No. It builds new layers from what is visible in the flat image, names them by content and fills in the background. Anything that was hidden or off-canvas in the original document was discarded when it was flattened, and the separated layers, completed hidden parts and background are redrawn by AI from your flat picture.

How do I avoid losing layers next time?

Keep the layered PSD (or a layered TIFF) as your master file and export flat copies from it. If you flatten to send a file, flatten a duplicate, and save it under a new name.