Page 1 of 1

invert image

Posted: 2011-05-04T12:46:58-07:00
by Nik
Hi there,

is there a way to invert an image similar to the Photoshop command?

I have used the below command to create a difference mask:

convert whitebackground.JPG blackbackground.JPG -compose difference -composite \
-separate -background black -compose plus -flatten \
difference_plus.gif

The image that is produced looks to be a good mask to remove the background from and image. The only problem is that the areas of the difference_plus.gif that are white I want to be black and vice versa. When I invert the image in Photoshop I can then use it to remove the background from the white.JPG using this command:

convert whitebackground.JPG difference_plus.gif \
-alpha off -compose CopyOpacity -composite \
overlay_removed.png

Many Thanks,
Nik

Re: invert image

Posted: 2011-05-04T12:53:16-07:00
by Bonzo
Try -negate

Re: invert image

Posted: 2011-05-04T13:10:32-07:00
by Nik
Perfect!!!!

Thanks Bonzo,

Nik

Re: invert image

Posted: 2011-05-04T19:34:35-07:00
by anthony
IM Examples, Color Modifications (global), Negate
http://www.imagemagick.org/Usage/color_mods/#negate