imagemagick-convertgimp

Imagemagick linear invert as in Gimp?


I'd like to LINEAR invert image in Imagemagick with the same output as in Gimp.

Original image:

Original image

Gimp invert:

Gimp invert

Gimp LINEAR invert:

Gimp LINEAR invert

Imagemagick "negate" function:

enter image description here

Which function should I use then? In Imagemagick documentation I didn't found "linear invert".


Solution

  • What is your Imagemagick version and platform? When I do the following on IM 6.9.13.3 on Mac OSX Ventura, I get

    convert map.jpg -negate x.jpg
    

    enter image description here

    That looks like a proper invert for the input and seems to match GIMP result.

    compare -metric rmse x.jpg GIMP.jpg null:
    135.592 (0.00206901)
    

    The comparison shows only a 0.2% difference between the IM result and the GIMP result.

    ADDITION

    From the GIMP docs, the inversion is done in linear colorspace. So in Imagemagick,

    convert map.jpg -colorspace rgb -negate -colorspace sRGB map_linear_invert.jpg
    

    enter image description here