How to Flatten an Image in GIMP

By Henrick July 16, 2026 3 min read Layers, Selections & Masks

Flattening an image in GIMP combines every layer into a single layer and fills transparent areas with the background color. It is the last step before exporting to formats like JPEG that do not support layers or transparency. Done at the wrong time, it can destroy work you cannot recover. Here is everything you need to know.

How to Flatten an Image

There is one menu path to flatten:

  1. Go to Image > Flatten Image.
  2. GIMP instantly merges all layers and removes the Layers panel entries, leaving a single layer named "Background."

There is no dialog or confirmation. It happens immediately. This is why it is important to understand exactly what it does before clicking.

What Flattening Does to Your File

What gets merged What gets lost permanently
All visible layersAll layer separation
Blend mode effects (baked in)Layer masks
Opacity settings (baked in)Text editability
Hidden layers (discarded)Transparency (filled with background color)

Two things surprise people the most:

  • Hidden layers are deleted, not merged. If you have a layer with the eye icon turned off, it is gone after flattening. It does not get combined - It gets discarded entirely.
  • Transparency is filled with white (or whatever your background color is). Flatten Image removes the alpha channel. If you need to export with transparent areas, use File > Export As and choose PNG before flattening.

When to Flatten and When Not To

Good time to flatten:

  • Before exporting to JPEG - JPEG does not support layers or transparency, so flattening prepares the image correctly.
  • When you are completely done and want to reduce file size for archiving.
  • Before handing a final file to someone who does not need to edit the layers.

Bad time to flatten:

  • While you are still making changes - You lose all the flexibility your layers provide.
  • Before exporting to PNG with transparency - Flatten first and you lose the transparent areas.
  • When you have hidden backup layers you might want to recover later.

The right workflow: finish all your work on the layered .xcf file, save it, then flatten and export. Never flatten the .xcf itself - Always keep the layered version. This is the same principle behind merging layers - save before you commit to any destructive step.

Safer Alternatives to Flatten Image

If you need a merged result but want to keep your layers intact:

  • Merge Visible Layers (Ctrl+Shift+M): Merges only visible layers into one and leaves hidden layers untouched. Keeps transparency. Better than Flatten when you want a merged result but still need your backup layers.
  • Edit > Copy Visible: Copies a flattened composite to the clipboard without touching your actual layers. Paste it as a new layer above everything else. Your original layers stay intact underneath.
  • Duplicate the image (Image > Duplicate): Opens an identical copy of the file in a new window. Flatten and export the copy, leave the original untouched.

Of these, duplicating the image is the safest - You are never touching the working file at all. The copy gets flattened and exported, and the working .xcf stays layered.

Can You Undo a Flatten?

Yes - within the current session. Press Ctrl+Z immediately after flattening and all your layers come back.

Once you close GIMP or save over the file as a flattened format (like JPEG), the undo history is gone. There is no recovering layers from a saved JPEG - Only from an .xcf backup. If you do not have an .xcf, the layers are permanently lost. This is the single biggest reason to always keep an .xcf version of anything you care about.

Quick Recap

  • Flatten: Image > Flatten Image - merges all visible layers, deletes hidden ones, removes transparency
  • Save your .xcf before flattening - there is no recovery after saving as JPEG
  • Safer: use Merge Visible or Edit > Copy Visible to get a merged result without destroying layers
  • Undo works within the session (Ctrl+Z) but not after saving and closing
Tags: Gimp layers Flatten

Share this article:

Twitter / X Facebook

Related Articles