10

as the title is saying. Using Photoshop, I want to invert the luminosity of my image using adjustment-layers, while the colors stay the same.

So here is my example image:

enter image description here

  • Dark Background (it's totally black in this example)
  • Light Text (it's totally black in this example)
  • two glowing edges

To explain it a little further. The expected result based on this image should look like the following: enter image description here

  • White Background
  • Black Text
  • Colors are the same

The Problems

I don't know how I can prevent the colors from being manipulated as well.
If I try to invert the image with an Invert Adjustment Layer with the blend mode of luminosity (which is the last in the list) it won't give me the desired result.

enter image description here

As you can see here, the Hue of the glow is still the same.
But the brightness has been flipped too.


I also tryed to calculate Channels in LAB-Mode and could not come up with a decent looking result.


The Solution

I don't want to manually select the text & the shape and fill it with the opposing color. That destroys the edges and looks awful.

Quick thought at the end: I need an selection by saturation if that's possible ... ;-)

2
  • There are several problems with this approach. Number one problem is that the image data is not linear in nature so inverting in a nonlinear mode just cases the gradients look different. But you can actually do the Masking the way you propose then delete the black background from the image.
    – joojaa
    Commented Jul 7, 2016 at 11:07
  • This is what i get when i un gamma an back (really is should convert to linear rgb but I didnt have a suitable profile), its is more accurate than whet your answers have but not exactly accurate. Unforytunately it also eats out some of the boldness of the text due to reversed contribution of the antialiasiation. i.sstatic.net/LVyfq.png
    – joojaa
    Commented Jul 7, 2016 at 12:29

4 Answers 4

4

Try the following to see why this doesn't work;

  1. Open your image
  2. Go to the LAB channel mode
  3. In your channels look at the lightness channel (L)
  4. This is your image stripped off all color
  5. If you invert this you will see you get pretty dark shadows
  6. no colors have been manipulated here, only the luminosity
  7. therefore > the problem lies with the luminosity.

You simply get shadows that are too dark.
This layers example should get you close.

enter image description here

1
  • I like the idea of changing the gamma with the levels command. But I thought there might be a way to do this basically mathematically correct, rather than approximating.
    – Type-Style
    Commented Jul 11, 2016 at 10:31
2

Like you discovered and others have said, Lab colorspace is perfect for this. As far as how to do it with adjustment layer, well invert the lightness by moving the left side all the way up and right side all the way down. At this point it might look a little harsh. To fix that you can then bring one of the points in a little effectively reducing the tonal range.

enter image description here

2
  • Add 2x 2.2 gamma corrections after a full inverse ;) Then it is computationally closer to ground truth (but still only approximate)
    – joojaa
    Commented Jul 7, 2016 at 12:30
  • The invert can be done with an invert adjustment layer. But I like the fact that you can nudge the gamma here.
    – Type-Style
    Commented Jul 11, 2016 at 10:29
1

Another way to to invert the hue first then the invert the image color.

1
  • 1
    Welcome to GDSE! We are looking for longer answers, that don't just describe how it works, but also why it works. Could you edit your answer to add a bit more info?
    – PieBie
    Commented Sep 17, 2019 at 13:45
0

I have actually made an application called LightDark Image Inverter to solve this problem. It inverts an image's brightness while preserving the color hue. It additionally has a feature to batch invert a group of images. Great for inverting wallpaper images for light/dark themes or generating light/dark themed assets for graphic design.

It can be found on the macOS App Store here: https://apps.apple.com/us/app/lightdark-image-inverter/id1507617598?mt=12

You can possibly achieve this effect in an image editor if the editor is capable of the two functions:

  1. Image Color Inversion
  2. Hue Rotation

First, invert the image color, then rotate the hue to 180 degrees to bring the color hue back to its original position.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.