To invert an image, every red, green and blue value becomes 255 minus its old value, so white turns black, red turns cyan and blue turns yellow. You can do it in a browser tool, in Photoshop (Image > Adjustments > Invert), in GIMP (Colors > Invert), or with one line of ImageMagick or Python.
Below are the steps for each, plus three cases where a plain invert gives the wrong result: transparent PNGs, screenshots you want in dark mode, and scanned film negatives.
What "invert" actually does
Adobe's Photoshop help describes it as converting each pixel's brightness to the opposite value on the 0 to 255 scale: 255 becomes 0, and 5 becomes 250. GIMP's documentation adds that hues are replaced by their complementary colors.
That math is exact, so inverting twice gets you back to the start, as long as the file is lossless. We inverted a PNG chart twice with ImageMagick and got back identical pixels. We did the same with a JPG saved at quality 90 after each step, and 31% of pixels came back slightly different (by up to 39 levels). Invert a PNG or your original, not a JPG that's been saved over and over.
Option 1: In your browser
Our invert image tool runs in the browser tab, so nothing is uploaded. We watched the network requests while converting and saw no image data leave the page.
- Drop in one or more images (JPG, PNG, WebP, HEIC, AVIF, GIF or BMP), or paste one.
- Keep Invert colors selected. The preview updates right away.
- Optional: lower the strength, or untick Red, Green or Blue to invert only some channels.
- Click Download PNG (JPG and WebP are also offered), or download all images as a ZIP.
Two test files loaded. The chart has been inverted at 100% strength on all three channels.
We checked the downloaded PNG against our own 255-minus-value calculation and it matched pixel for pixel.
Option 2: Photoshop or GIMP
Photoshop. Choose Layer > New Adjustment Layer > Invert, or click the Invert icon in the Adjustments panel. Image > Adjustments > Invert also works, but Adobe notes it changes the layer directly instead of adding an adjustment you can switch off (Adobe help).
GIMP (free). Use Colors > Invert. GIMP also has Colors > Linear Invert, which inverts in linear light and leaves the alpha channel alone (GIMP docs). The difference shows in the midtones: for an sRGB image, mid-gray (128) becomes 127 with Invert but about 229 with Linear Invert, by the standard sRGB conversion math. Try both and keep the one that looks right.
Option 3: Command line and code
ImageMagick's -negate replaces each pixel with its complementary color:
magick input.jpg -negate output.jpg
For transparent PNGs, add -channel RGB. In our test with ImageMagick 7.1.1-43, plain -negate also flipped the alpha channel, so the logo vanished and the empty background turned solid white:
magick logo.png -channel RGB -negate logo-inverted.png
Same transparent PNG, two commands. Only the second keeps the transparency.
In Python, Pillow's ImageOps.invert works on RGB and grayscale images. The ImageOps docs warn that most of its operators only work on L and RGB images, and on Pillow 13.0.0 an RGBA image raised OSError: not supported for mode RGBA. Split off the alpha channel first:
from PIL import Image, ImageOps
im = Image.open("logo.png").convert("RGBA")
r, g, b, a = im.split()
rgb = ImageOps.invert(Image.merge("RGB", (r, g, b)))
Image.merge("RGBA", (*rgb.split(), a)).save("logo-inverted.png")
On a web page, CSS filter: invert(1) inverts an element on screen without touching the file. MDN lists it as widely available across browsers since September 2016, and values between 0 and 100% give a partial invert (MDN).
When a plain invert is the wrong tool
Screenshots and charts for a dark page
A plain negative changes every hue. On our sample chart, the blue line turned orange, the green line turned magenta and the red bars turned teal, so the legend and any text that names a color no longer match.
Left to right: original, plain invert, and a lightness flip that keeps each hue.
The fix is to flip only lightness and keep hue and saturation (an HSL lightness flip). The browser tool calls this Dark mode (keep colors). If you made the chart yourself, re-exporting it with a dark theme usually looks best.
Scanned color film negatives
Color negative film has an orange base. Adobe states that, because of this orange mask, the Invert adjustment can't make accurate positives from scanned color negatives. Here's what that looks like on a simulated negative we made from a public domain portrait of Grace Hopper:
Plain invert leaves a blue cast. Stretching each channel on its own removes most of it.
After a plain invert, the average blue level was more than twice the red level. Stretching each channel separately (we clipped the darkest and brightest 0.5%) brought the averages back within about 0.01 of the original photo. The browser tool's Film negative to photo effect does this kind of per-channel stretch. Crop off the film border first, because the bright rebate skews the balance. For a serious archive, use your scanner software's color negative mode, which is what Adobe recommends.
Screen invert is not the same thing
Invert settings on your computer change the display, not the file. On a Mac, System Settings > Accessibility > Display > Invert colors has a Smart mode, which skips images and video, and a Classic mode, which inverts everything (Apple Support). Windows has Settings > Accessibility > Color filters > Inverted, and Magnifier can invert with Ctrl+Alt+I (Microsoft Support). They're good for reading at night, but the picture you save or send keeps its original colors.
FAQ
Is inverting an image reversible?
Yes, a full invert of a lossless file is its own opposite. Partial strengths, lightness flips and film conversions aren't exactly reversible, so keep the original.
Why did my transparent PNG turn into a white box?
Either the tool inverted the alpha channel too (ImageMagick without -channel RGB), or you saved as JPG, which has no transparency. Save as PNG or WebP.
How do I invert just part of an image?
Select the area first in Photoshop or GIMP, then run Invert. Only the selection changes.
Can I invert a photo on my phone without an app?
Yes. A browser tool that processes files on your device, like our invert image tool, works in a mobile browser. The phone's accessibility invert setting only changes the screen.
What's the difference between Invert and Linear Invert in GIMP?
Invert flips the stored pixel values, while Linear Invert flips them in linear light and leaves alpha untouched. Linear Invert makes midtones much lighter, so a gray photo looks washed out rather than dark.
Cuelark Team




Top comments (0)