Search code examples
imagemagickmogrify

How to save single channel EXR images with ImageMagick


I have a 32 bit single channel EXR image that I want to crop using ImageMagick, the problem is after I crop it it got saved into 32 bit 3 channel image by ImageMagick.

Below are the attempts that I tried that didn't work

mogrify -crop 200x100+238+200 test.exr -colorspace Y

This returns error mogrify: unrecognized image colorspace `Y'.

mogrify -crop 200x100+238+200 test.exr -channel Y

This returns 32 bit 3 channel image.

mogrify -crop 200x100+238+200 test.exr -separate 

This returns 8 bit 1 channel image.

I am on Ubuntu 16.04 and my version of ImageMagick is 6.9.6-4 Q32 x86_64.

How can I make ImageMagick to save my EXR file with the original single channel 32 bit format?


Solution

  • One expert from the ImageMagick forum actually posted an answer which works perfectly for me.

    convert test.exr -crop 200x100+238+200 +repage -define exr:color-type=Y result.exr