
-layers flatten uses the first image's virtual canvas and clips material outside it. If a layer extends to a negative coordinate, changing its visible pixels is not the first repair to try. -layers merge instead forms a composite large enough to contain the supplied layers, including negative-offset content.
Inspect geometry before changing artwork
Record each layer's raster dimensions and virtual-canvas offset. An image can contain valid pixels while its placement puts some of them left of or above the chosen output canvas origin.
ImageMagick's layer documentation distinguishes this from transparency and visibility. A missing corner after flattening can be a canvas-boundary result rather than a deleted source corner or a failed decoder.
Choose the intended composite extent
For a fixed-size deliverable, flattening may be correct: the first virtual canvas defines the accepted rectangle, and outside material is intentionally excluded.
If all supplied layer content must survive, apply -layers merge to the prepared sequence instead. The resulting raster covers the union of the layers. The manual says that the merged image retains a virtual offset reflecting its placement, even when negative, while preserving the first image's virtual-canvas size.
Do not substitute mosaic when negative coordinates matter. Its expansion is in the positive direction, so it can still clip content at the top or left.
Decide whether global placement must remain
Following merge with +repage removes the resulting placement offset and resets the virtual canvas. The relative positions of the composited layers remain in the pixels, but their original absolute placement is no longer represented in the same way.
Use that reset for a standalone flattened asset only when the surrounding workflow does not need its former global coordinates. The paste-position guide explains a separate coordinate-transfer concern.
Verify the negative-coordinate extremities
Compare a distinctive feature at the leftmost and topmost layer extents. Check the merged raster bounds and any retained page offset, not merely the center of the composition.
The GIMP visible-composite guide decides whether original layers remain editable. This task decides the spatial extent of a flattened ImageMagick result; neither merge nor flatten here promises a retained editable layer stack.
This is a documented geometry procedure, not a performed merge. Confirm the actual ImageMagick 7 build and output format's handling of offsets before relying on placement metadata in a handoff.
Related tasks
- GIMP: New from Visible or Merge Visible Layers?
- Why Does a Layer Jump to the Center When I Paste It Into Another Photoshop File?
Sources and scope
- ImageMagick 7 option reference: layers: Flatten clips to the first virtual canvas; merge includes the union of layers including negative offsets, preserving the resulting placement offset until reset.
Documentation-based ImageMagick 7 guidance checked against official pages captured October 23, 2026. Examples and inspections are proposed, not performed. Confirm the installed build, coder support and actual shell before use.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: Paparazzi Ratzfatzzi / Pexels, Pexels License. This is an illustrative source photograph, not an application screenshot or a generated test result.