Image Size Reducer
PNG color swapper

Swap Colors in a PNG

Exchange two colors so each one takes the other's place. Use it to flip a foreground with its background, mirror a palette, or see both sides of a theme pair, all without losing transparency or adding a new shade to the file.

  • Exchanges two colors at once
  • Tolerance control for edges
  • Several pairs in a row
  • Transparency untouched
  • Runs in the browser
Open the swapper

Two Colors Trading Places

A replacement sends one color somewhere new. A swap makes two colors change places, which is a different operation with a different failure mode.

Replacing a color is a one-way street. You point at a shade, say what it should become, and every pixel wearing that shade changes. Swapping is reciprocal. Two shades are named, and every pixel wearing the first takes the second while every pixel wearing the second takes the first. Nothing is created and nothing is destroyed; the two colors simply trade places. That difference sounds small and is not. It is the only way to flip a figure and its ground without a second pass, it is the natural operation for testing a palette against its own mirror image, and it fails in a way a plain replacement cannot. If you swap colors in a PNG one shade at a time, the first pass destroys the very pixels the second pass was waiting for.

What the Color Swapper Does

Two color pickers, a tolerance that decides how mixtures are treated, and transparency left exactly as it was.

Two-way exchange

Both colors change places in a single pass, so neither half is destroyed before the other can move.

Tolerance control

Sets how close a pixel must be to count as one of the two colors, which is the setting that keeps edges clean.

Several pairs

Flip one pair after another, front and back or accent and neutral, and revert the whole set the same way.

Transparency respected

Alpha is carried through, so a cut-out keeps its empty background while its two colors trade places.

Local processing

The exchange runs in the browser and the file never leaves the device.

ImageSizeReducer

ImageSizeReducer

@imagesizereducer

Why both colors have to move at once

Doing the job in two passes looks obvious and does not work. Replace the dark blue with the pale yellow, then replace the pale yellow with the dark blue, and the second pass matches the pixels the first pass has just created, so everything ends up dark blue. The pale yellow was gone before it had a chance to move. The fix is to decide both outcomes before touching a single pixel. Each pixel is examined once and assigned its new color according to what it was, never according to what anything has already become. That is why a swapper needs two color pickers rather than one, and why the exchange has to be applied as a single combined step.
Swap them
Two color swatches shown exchanging places in one step
ImageSizeReducer

ImageSizeReducer

@imagesizereducer

Flipping a foreground and its background

The classic case is a mark drawn in two colors, a shape and the space around it. Swapping them produces the negative without redrawing anything: the shape takes the background color and the surround takes the shape color. It is the quickest way to see whether a mark reads in reverse, which matters for logos that will sit on dark surfaces and for buttons that invert on hover. For this to come out clean, both colors have to be genuinely present in the file. A background that is transparent is not a color, so there is nothing to trade with, and the exchange leaves the cut-out exactly as it was.
Swap them
An icon and its background shown with their colors exchanged
ImageSizeReducer

ImageSizeReducer

@imagesizereducer

An operation undone by running it again

Because the exchange is symmetric, applying it a second time with the same pair restores the original arrangement. That is a useful property: a theme can be flipped back and forth while a decision is being made, with no need to keep the original copy open beside it. The catch is antialiasing. Edge pixels are not one color or the other but a blend of both, and a blend of two colors does not land symmetrically once it is rounded. A single swap can therefore shift an edge by a shade, and a long chain of swaps will drift. For comparing designs that is irrelevant; for a file headed to print, start from the original each time.
Swap them
A swapped image and the same image restored by swapping again
ImageSizeReducer

ImageSizeReducer

@imagesizereducer

What happens at the boundary between them

Wherever the two colors meet, the boundary is made of pixels that are mixtures. A tolerance decides whether a mixture belongs to color A, to color B, or to neither. Set it loosely and the swap sweeps in the halo and turns it into a visible outline in the wrong color. Set it tightly and a fringe of the old shade survives along every edge, which shows up at once on a pale background. This is the one setting that separates a clean result from a messy one, and it is worth previewing at full zoom rather than judging from a thumbnail. Anti-aliased artwork with soft curves is the hardest case and hard-edged artwork the easiest. If you swap colors in a PNG and the result looks slightly dirty around the shapes, the tolerance is the first thing to open.
Swap them
A boundary between two colors shown at high zoom with a fringe
ImageSizeReducer

ImageSizeReducer

@imagesizereducer

Swapping is not the same as recoloring

A recoloring tool takes one color and gives it a new value chosen from anywhere in the spectrum. A swap takes two colors that already exist and exchanges them, adding no new value to the image at all. The palette after a swap holds exactly what the palette held before, merely rearranged. That distinction is what settles the choice of tool. Matching a brand color, warming a photograph, or turning a red icon blue are all recolor jobs. Inverting a two-tone mark, building a dark variant of a diagram, or checking a layout where ink and paper trade roles are swap jobs, and none of them can be done by recoloring without two passes and a risk of collision.
Swap them
A one-way recolor compared with a two-way exchange
ImageSizeReducer

ImageSizeReducer

@imagesizereducer

Testing a palette against its mirror

Designers often want to know what a diagram looks like with its accent and its base exchanged, and a swap answers that in one step. On a chart the effect is a genuinely different reading: lines that were light become heavy and the grid recedes, which is occasionally the better hierarchy and occasionally a warning that the original was already right. Running several pairs in sequence turns the tool into a small palette tester. Front and back, accent and neutral, border and fill can each be flipped independently, and the whole set can be reverted the same way, which makes it practical to compare variants in a meeting rather than guess at them.
Swap them
A chart shown with its accent and base colors exchanged
ImageSizeReducer

ImageSizeReducer

@imagesizereducer

Where the exchange stops helping

Swapping is a poor fit for photographic work. A photograph has no small palette, only millions of near-identical values, so naming two colors and exchanging them either misses almost everything or takes a slice wide enough to produce a strange two-tone print. It also cannot invent a color that is not already there. A pair made of one shade present in the file and one that is not will simply do nothing, because there is nothing for the second color to occupy. Both halves have to exist for the exchange to be visible, which is a good reason to sample the actual pixels rather than type a value from memory.
Swap them
A photograph shown with a failed two-color exchange
ImageSizeReducer

ImageSizeReducer

@imagesizereducer

Working on the file you already have

Palette testing happens constantly and rarely deserves a round trip to a server. The exchange runs in the browser, on the copy already on the machine. Nothing is uploaded, no account is needed, and the pair can be changed as many times as the decision takes. When one arrangement is finally right, the file downloads straight from the page.
Swap them
A color exchange being applied inside a browser window

How to Swap Colors in a PNG

Four steps. The tolerance in step three is the one that decides how the edges come out.

Step 1

Upload the PNG

Start from the original rather than an already-swapped copy, so the thresholds are measured against the true colors.

Step 2

Pick both colors

Sample the actual pixels for both halves of the pair; a typed value that is only close will match nothing.

Step 3

Set the tolerance

Open it just far enough to catch the anti-aliased edges, and inspect the result at full zoom before moving on.

Step 4

Apply and download

Confirm the palette has been rearranged rather than added to, then save the file.

Who Swaps Colors

Four kinds of work where exchanging two colors answers a question in one step.

ID

Icon designers

two-tone marks

Flipping the shape and the surround shows at once whether a mark reads in reverse. It is much faster than redrawing the negative by hand.

BD

Brand designers

dark variants

A diagram that has to work on a dark surface is often just its two main colors exchanged. Testing that before committing saves a rebuild later.

DV

Data visualizers

chart hierarchy

Exchanging the accent with the base reorders the whole reading of a chart. Seeing both arrangements side by side makes the hierarchy decision obvious.

PK

Packaging designers

ink and paper

A label with ink and paper colors traded shows what a reversed print run would look like, without setting up a second file.

Frequently Asked Questions

How an exchange differs from a replacement, and what the tolerance setting is really doing.

Trade the two colors

Upload a PNG, name both colors, and exchange them in a single pass, for a reversed icon, a dark variant, or a palette you want to see mirrored.

Swap them
Two Colors, One Exchange

The operation that adds nothing and changes everything

Most color tools work in one direction. A recolor takes a shade and sends it somewhere new, a hue shift rotates every color by the same angle, an inversion flips each channel against its opposite. Swapping is the odd one out, because it introduces no new value at all: two colors that are already in the file trade places, and the palette is left holding exactly what it held before, merely rearranged. That property is what makes the exchange necessary rather than merely convenient. The obvious two-pass approach fails, since the first replacement destroys the pixels the second one was looking for, so both outcomes have to be settled before a single pixel moves. It is also what makes the operation reversible, at least in principle, so a theme can be tried, questioned, and flipped back without a spare copy of the original. The trade is in the edges. Where two colors meet, the pixels are mixtures, and the tolerance decides whether those mixtures are swept into one side or left as a dirty fringe of the old shade. Judge that at full zoom and the work is straightforward. Take both colors from the file itself rather than from memory, and when you swap colors in a PNG you are looking at the same picture with its two halves exchanged, which is occasionally the answer and always worth seeing.

Smaller files, same picture.