# RMagick: Method to invert the colors of an image

**URL:** <https://www.ruby-forum.com/t/rmagick-method-to-invert-the-colors-of-an-image/151589>\
**Category:** Ruby\
**Created:** [October 23, 2008, 9:02am UTC](https://www.ruby-forum.com/t/rmagick-method-to-invert-the-colors-of-an-image/151589 "2008-10-23T09:02:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [October 23, 2008, 9:02am UTC](https://www.ruby-forum.com/t/rmagick-method-to-invert-the-colors-of-an-image/151589/1 "2008-10-23T09:02:15Z")

</div>

Hi,

I am using RMagick gem to work with images. In one of my methods, I want  
to totally invert the colors of the image file. I searched the Rmagick  
API but am not able to converge to a method which can do so (Probably,  
there exists one, but I am not able to find it)

Can anyone please tell if there is any method in RMagick to accomplish  
this task?

Thanks,  
Anukul

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [October 23, 2008, 9:20am UTC](https://www.ruby-forum.com/t/rmagick-method-to-invert-the-colors-of-an-image/151589/2 "2008-10-23T09:20:30Z")

</div>

2008/10/23 Anukul S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Hi,
> 
> I am using RMagick gem to work with images. In one of my methods, I want  
> to totally invert the colors of the image file. I searched the Rmagick  
> API but am not able to converge to a method which can do so (Probably,  
> there exists one, but I am not able to find it)
> 
> Can anyone please tell if there is any method in RMagick to accomplish  
> this task?

I guess you want to negate the colors.

Refer to [http://studio.imagemagick.org/RMagick/doc/image2.html#negate](http://studio.imagemagick.org/RMagick/doc/image2.html#negate)

Regards,

Park H.
