DEV Community

Sherotree
Sherotree

Posted on

Merge stacked PNG exports in the tab and keep the transparency

Design drops three files in the ticket: hero-bg.png, hero-subject.png, and hero-shadow.png. Each has a real alpha channel. The request is one raster for the marketing site. Someone flattens them in a desktop editor, exports a JPEG “to be safe,” and the edges pick up a matte. The repo gets a muddy hero.

I’ve started treating a stacked PNG export as a merge job that should keep transparency, not as an excuse to flatten to JPEG in the nearest app. If the layers are already PNGs, the composite can stay a PNG until you have a reason to change format.

When a merge in the tab is enough

Good fit:

  • A handful of already-sized PNG layers that share a canvas
  • You need a single asset with the alpha intact (hero, sticker, icon stack)
  • The alternative is “open Photoshop for a two-minute flatten”
  • You do not want to upload unreleased brand art to a random converter

Poor fit:

  • Layered source that still needs masking, blending modes, or type changes — go back to the design file
  • A 20-layer PSD or a file the team already composites in a build step
  • Color-managed print work

If the design tool can export a flattened PNG with alpha, prefer that. The merge is for the case where you were given the stack, not the source.

A simple compositing policy

  • Keep alpha unless the destination literally cannot use it
  • Same dimensions — do not “merge” by stretching one layer to fit another
  • Do not JPEG a transparent stack “for size”; compress the PNG, or convert later with a tool that understands alpha
  • Name the output hero-composite.png, not Export-Final-v3.jpg

The merged file still belongs in the image pipeline you already have (responsive sizes, hashing, a later WebP pass). The merge step should not be the step that destroys the alpha.

Merge locally, in the browser

You want a drop target, a predictable layer order, and a PNG download that still has transparency. No mandatory upload of unreleased art.

When the files are already on disk and you are in the browser, an in-tab merge is enough. Uwarp’s merge-PNG tool stacks PNGs in the browser and keeps transparency, without requiring a server upload. Handy for the one-off hero or icon stack. If you composite the same layers on every build, script it with sharp or the design tool’s export instead of clicking through.

Caveats: blending modes, color profiles, and “this shadow was designed in linear light” are not something a simple stack will reinvent. If the composite looks slightly off, go back to the source file. Check the output at 1x and on a dark background so a leftover matte shows up before you commit.

If you need to compare the composite against a design preview, put both on a dark and a light checkerboard. A leftover white matte is obvious there and invisible on a white docs page. That check takes longer to describe than to do, and it is the usual reason a “quick flatten” gets sent back.

Reject / send back

Reject

  • A JPEG flatten of a transparent stack, with a halo on dark backgrounds
  • Uploading unreleased brand layers to a random online merger
  • Checking in three overlapping PNGs that are always used as one image, with no composite and no build step
  • Stretching layers of different sizes and calling it done

Accept

  • A single PNG composite with the alpha intact, plus the source layers if the team still needs them
  • A build-step composite for assets that change often
  • A later, explicit format conversion once the flatten is correct

Top comments (0)