How to Change the Color of an Object in a Photo

Showing a product in a color you have not photographed, or making a jacket match a brand palette, comes down to one job: change one object’s color and leave everything else alone. This guide explains why some recolors look real and others look painted on, then covers four ways to do it in Photoyam.

What makes a recolor look real

Every pixel can be described by three numbers: hue (where the color sits on the color wheel, from red at 0° through green at 120° and blue at 240°), saturation (how intense it is) and lightness (how bright it is). The shading on an object, its highlights, fabric folds, scratches and printed texture are almost entirely stored in the lightness. The hue is what we call its color.

A convincing recolor changes the hue, sometimes the saturation, and keeps the lightness. Painting a flat color over a shirt fails because it replaces the light too. Every method below keeps the object’s light and shade.

The other half is deciding where the change applies. Most failed recolors are selection problems, not color problems, so expect to spend more time on the selection than on the sliders.

Four methods and when to use each

Ways to recolor an object in Photoyam
MethodWhere to find itBest forEditable later?
Hue/Saturation adjustment layer + maskLayer › New Adjustment Layer › Hue/SaturationMost jobs: products, clothing, cars, wallsYes, settings and mask
Replace ColorImage › Adjustments › Replace Color…One distinct color spread across the imageNo, it changes the layer’s pixels
Color Replacement brushBrush group in the toolbar (B)Small areas that are hard to selectNo, it paints pixels
Solid Color fill layer in Color modeLayer › New Fill Layer › Solid ColorHitting an exact HEX valueYes, color, blend mode and mask

Note that Image › Adjustments, including Hue/Saturation… (Ctrl+U, Cmd+U on a Mac), changes the active layer’s pixels when you click OK, while Layer › New Adjustment Layer creates a layer you can re-edit later.

Worked example: a red mug turned teal

The test image is a red mug with deep shadows on both sides, a bright highlight and white lettering, next to a green plant and a white saucer. All of that has to survive.

  1. Open the photo. In the editor, use File › Open… (Ctrl+O).
  2. Select the object by color. Choose Select › Color Range…. Set Select to the color family of the object, here Reds, or leave it on Sampled Colors and click the object to sample it. Set Selection Preview to Black Matte: anything still visible is selected, anything black is not.
  3. Remove what does not belong. Click OK. Color Range works on the whole image, so check for strays. Press M for the Rectangular Marquee, click Intersect with selection in the options bar, and drag a box around the object. Only the overlap between the box and the color selection stays.
  4. Add a Hue/Saturation adjustment layer. Choose Layer › New Adjustment Layer › Hue/Saturation. The layer appears above the photo and its controls open in the Properties panel.
  5. Turn the selection into its mask. Unlike Photoshop, Photoyam does not convert an active selection into the new layer’s mask automatically. With the selection still active, choose Layer › Layer Mask › Reveal Selection (or click Add layer mask at the bottom of the Layers panel). Then press Ctrl+D to deselect.
  6. Shift the hue. Drag Hue in Properties. Red sits at 0°, and teal is roughly opposite it, so +175 turned the mug teal. The two spectrum bars under the sliders show each input color above the color it becomes.
  7. Clean up the mask. With the mask active, the Brush (B) paints it: black hides the change, white reveals it. If the edge looks cut out, a Feather of 1–2 px in Properties softens it.
  8. Save and export. File › Save As Project (.psy) keeps the layer editable for a navy or green version later; File › Export As makes a PNG or JPG.
The Color Range dialog in the Photoyam editor set to Sampled Colors with Fuzziness 60 and Black Matte preview. The canvas is black except the red mug's lit front, rim and handle; the dark left and right sides of the mug and the white lettering are black, meaning unselected.
A single click with Sampled Colors (Fuzziness 60) picks up the lit front of the mug but misses its shadowed sides, which would stay red after the recolor. The Reds preset, or a few extra clicks with Add to Sample, fixes that.

Why the preset in step 2? Sampled Colors compares colors, so the dark red on the shaded side counts as different from the bright red you clicked. The hue presets select by hue, so light and dark versions of a color are caught together. The catch is that dull colors near that hue get partly selected too: in an earlier version of the test image, Reds also caught a beige wall and a wooden table, and the recolor turned them blue-gray. The intersect box in step 3 removes them.

The mug is now teal with its shading, highlight and white MORNING lettering intact, while the green plant, brown pot, white saucer and gray background are unchanged. The Layers panel shows a Hue/Saturation adjustment layer with a black-and-white mask above the photo, and Properties shows the mask options and the Hue slider moved far to the right.
The finished recolor: a Hue/Saturation layer masked to the mug, Hue +175. Shadows, highlight and lettering survive because only the hue changed.

Changing only one color family

The Channel menu in the Hue/Saturation editor starts on Master, which shifts every pixel under the mask. Pick Reds, Yellows, Greens, Cyans, Blues or Magentas instead and the sliders only affect pixels of that hue. Each family has full effect within 15° of its center and fades to nothing by 45°, and that range is fixed: there are no range sliders or eyedroppers in this editor as there are in Photoshop.

Channels let a rough mask work: recolor a red jacket with the channel on Reds and its blue zipper and black buttons stay as they are, even inside the mask.

Replace Color for quick global swaps

Image › Adjustments › Replace Color… does selection and shift in one dialog. It has a Target color, Fuzziness (0–100, default 40), and Hue (±180), Saturation and Lightness (±100). Pixels identical to the target get the full shift; pixels further away get less, down to none at the Fuzziness limit, so edges blend instead of breaking.

The dialog has no eyedropper and its target starts at pure red, so first press I for the Eyedropper, click the object, read the Hex value in the Color panel and type it into the Target picker. Replace Color changes the active layer when you click OK, so press Ctrl+J first to work on a copy. If a selection is active, only the selected area changes.

The Replace Color dialog over an illustrated lake at sunset, with an orange Target swatch, Fuzziness 35, Hue -45, Saturation 10, Lightness 0 and Preview ticked. The orange glow along the horizon has turned pink, while the purple sky, mountains and dark trees are unchanged.
Replace Color on the sample landscape: Target #F0A070, Fuzziness 35, Hue −45, Saturation +10. The orange glow turns pink and the purple sky barely moves, because it is far from the target color.

The Color Replacement brush

The Color Replacement brush lives in the Brush group of the toolbar. Press B repeatedly to cycle Brush, Pencil, Color Replacement, or open the group’s flyout. It paints the foreground color, but only onto pixels similar to the color under the center of the brush; Tolerance in the options bar (30% by default) sets how similar. Its Mode can be Hue, Saturation, Color (the default) or Luminosity. Color mode changes hue and saturation and keeps the original lightness, which is what you want for recoloring.

Keep the center of the brush on the object and let its edge overlap the background, which is protected as long as its color is different enough. Lower Tolerance if color leaks; raise it if shadows stay unpainted. The brush changes pixels directly, so use it on a layer copy.

Matching an exact brand color

A hue shift is relative, so it cannot land on a specific HEX value. For that, choose Layer › New Fill Layer › Solid Color, type the HEX code in the dialog and click OK. Photoyam adds a full-canvas Color Fill layer above the active layer. Set its blend mode in the Layers panel to Color: it takes hue and saturation from the fill and lightness from the object, so the shading survives. Then restrict it to the object with Layer › Layer Mask › Reveal Selection, or put the object on its own layer and use Layer › Create Clipping Mask (Ctrl+Alt+G, Cmd+Option+G on a Mac).

Because lightness still comes from the photo, the lit side reads lighter than the swatch and the shadow side darker, as a real object in that color would. The Hue blend mode is a gentler alternative that keeps the object’s own saturation.

White, black and gray objects

A hue shift does nothing to white, black or gray: those pixels have no saturation, so there is no hue to rotate. That is why the Hue slider does nothing on a white T-shirt.

  • White and light gray: use a Solid Color fill layer in Multiply mode, masked to the object. Multiply turns white into exactly the fill color and keeps every fold and shadow darker. Colorize in Hue/Saturation also works; raise its Saturation well above the default 25 and lower Lightness slightly.
  • Black and dark gray: brighten the object first with a masked Levels or Curves layer, then recolor it. Expect a deep color: black to bright yellow almost always looks painted, because the detail a bright color needs is not there.

Troubleshooting

A thin line of the old color remains around the edge

The mask is slightly too tight. Delete it, reselect, run Select › Modify › Expand… by 1–2 px and add the mask again, or paint the edge white on the mask with a small soft brush.

The background or skin changed color too

Reds and oranges share hues with skin, wood and warm walls. Paint those areas black on the mask, or set the Channel to the object’s color family.

Nothing happens when I move the sliders

Check that the adjustment layer sits above the photo, since adjustment layers affect only the layers below them; that its mask is not all black; and that the object actually has a color (see the section on white and black objects).

Try it in Photoyam

Color Range, Hue/Saturation adjustment layers, masks and fill layers in a free editor that runs in your browser. No sign-up, and your photos stay on your device.

FAQ

Can I change the color of a white or black object?

Not with a hue shift alone, because white, black and gray pixels have no hue to rotate. For white or light gray, add a Solid Color fill layer in Multiply mode or tick Colorize in Hue/Saturation. For black, brighten the object first with a masked Levels or Curves layer, then recolor it, and expect a dark result rather than a bright one.

Is the color change permanent?

Adjustment and fill layers are not: you can change or delete them at any time, and a Photoyam project (.psy) keeps them. Image > Adjustments (including Replace Color) and the Color Replacement brush change the layer's pixels, so press Ctrl+J to work on a copy first.

How do I match an exact HEX brand color?

Use Layer > New Fill Layer > Solid Color, type the HEX value, set the fill layer's blend mode to Color and mask it to the object. The object keeps its own light and shade, so lit areas come out lighter than the swatch and shadows darker.

Why does Color Range also select parts of the background?

Color Range looks at color across the whole image, not at objects. Warm backgrounds, wood and skin share hues with reds and oranges. After clicking OK, use a marquee or lasso in Intersect with selection mode around the object, or paint the stray areas black on the adjustment layer's mask.

Can I remove the color from just one object instead?

Yes. Use the same masked Hue/Saturation layer and drag Saturation to -100, or use a Black & White adjustment layer with a mask. To turn a whole photo black and white in one step, the Photoyam grayscale page does it without opening the editor.