How to use ImageMagick to splitt multi-channelr EXR?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
mnhan32
Posts: 2
Joined: 2014-12-21T05:14:08-07:00
Authentication code: 6789

How to use ImageMagick to splitt multi-channelr EXR?

Post by mnhan32 »

Hey there,
I want to use ImageMagick to split multi-channel EXR from my Houdini render.
I just compiled IM 6.9.0 with open-exr and HDRI support.
Here is some info:

Code: Select all

identify -version

Code: Select all

Version: ImageMagick 6.9.0-0 Q16 x86_64 2014-12-21 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC HDRI Modules OpenMP
Delegates (built-in): bzlib ltdl lzma openexr tiff x xml zlib
However, when I try identify -verbose ./Destop/test222.exr and all I got is RGBA info

Code: Select all

Image: ./test222.exr
  Format: EXR (High Dynamic-range (HDR))
  Class: DirectClass
  Geometry: 640x480+0+0
  Units: Undefined
  Type: TrueColorAlpha
  Endianess: Undefined
  Colorspace: RGB
  Depth: 16-bit
  Channel depth:
    red: 16-bit
    green: 16-bit
    blue: 16-bit
    alpha: 16-bit
  Channel statistics:
    Pixels: 307200
    Red:
      min: 0 (0)
      max: 33695.5 (0.51416)
      mean: 1088.45 (0.0166087)
      standard deviation: 1517.83 (0.0231606)
      kurtosis: 90.6998
      skewness: 6.7965
      entropy: 0.632623
    Green:
      min: 0 (0)
      max: 88638.6 (1.35254)
      mean: 2736.97 (0.0417635)
      standard deviation: 2128.56 (0.0324797)
      kurtosis: 32.1859
      skewness: 2.31487
      entropy: 0.675023
    Blue:
      min: 0 (0)
      max: 31407.5 (0.479248)
      mean: 2798.91 (0.0427086)
      standard deviation: 1800.32 (0.0274711)
      kurtosis: 20.9794
      skewness: 1.07615
      entropy: 0.662711
    Alpha:
      min: 0 (0)
      max: 65535 (1)
      mean: 50698.7 (0.773613)
      standard deviation: 27385.3 (0.417873)
      kurtosis: -0.28718
      skewness: 1.3076
      entropy: 0.0706214
  Image statistics:
    Overall:
      min: 0 (0)
      max: 88638.6 (1.35254)
      mean: 5365.15 (0.0818669)
      standard deviation: 13784.3 (0.210335)
      kurtosis: 17.4735
      skewness: 4.66399
      entropy: 0.510245
  Alpha: rgba(0,0,0,0)   #0000000000000000
  Rendering intent: Undefined
  Gamma: 1
  Background color: rgba(255,255,255,1)
  Border color: rgba(223,223,223,1)
  Matte color: rgba(189,189,189,1)
  Transparent color: rgba(0,0,0,0)
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 640x480+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Properties:
    date:create: 2014-12-21T19:44:33+08:00
    date:modify: 2014-12-21T19:44:33+08:00
    signature: 30d5e784d9f21432171d5814448b8feec0fa4505e68b72856d85d24c43fcea4c
  Artifacts:
    filename: ./test222.exr
    verbose: true
  Tainted: False
  Filesize: 4.014MB
  Number pixels: 307K
  Pixels per second: 15.36GB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.0-0 Q16 x86_64 2014-12-21 http://www.imagemagick.org
This image actually contains may other channels, like all_coat, all_diffuse, all_reflect,......,etc.
My question is, how do you list and subtract all those channels existed in a EXR file?

Tks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by fmw42 »

I do not know if IM supports multi-channel EXR files. But the best thing would be to upload your file to dropbox.com and put the URL here so the developers can inspect it.
mnhan32
Posts: 2
Joined: 2014-12-21T05:14:08-07:00
Authentication code: 6789

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by mnhan32 »

Hey fmw42,
Thanks for reply.

I just upload a file, test32bit.exr, to Dropbox for anyone who want to inspect it.
https://www.dropbox.com/s/uilntxp08h2qt ... t.exr?dl=0

Tks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by fmw42 »

I do not know much about EXR file format, though I have used them infrequently. The last I knew, IM only supported the "half format". That may have changed. But I do not know if IM supports multilayer EXR? I think one of the IM developers may have to look into this for you.
kustaa
Posts: 4
Joined: 2016-03-02T14:33:42-07:00
Authentication code: 1151

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by kustaa »

Hi,
is there any update on this?
Is it possible to extract channels from multichannel exr currently?

thanks,
Kustaa
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by fmw42 »

I tried to download your EXR file, but it seems to have been moved or deleted (404 Error). If you still want me to examine it, re-post it.
kustaa
Posts: 4
Joined: 2016-03-02T14:33:42-07:00
Authentication code: 1151

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by kustaa »

hi,
heres a multilayer exr. It contains few rgb layers.
let me know if this helps!

https://www.dropbox.com/s/dgn0gzg0xwv2w ... r.exr?dl=0

Kustaa
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by fmw42 »

Unfortunately, as best I can tell, Imagemagick only sees one layer and RGBA channels only according to identify -verbose multilayer.exr. Also Photoshop won't open it. My GraphicConvert opens it, but only sees the same as IM as does Mac PREVIEW.

I see no evidence for any all_coat, all_diffuse, all_reflect information or channels.
kustaa
Posts: 4
Joined: 2016-03-02T14:33:42-07:00
Authentication code: 1151

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by kustaa »

this is actually different image, it has for example direct_diffuse and direct_specular layers in it.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by fmw42 »

I saw no other layers in the file, either.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by snibgo »

Exiftool reports:

Code: Select all

Channels                        : A float 1 1, B float 1 1, G float 1 1, R float 1 1, direct_diffuse.B float 1 1, direct_diffuse.G float 1 1, direct_diffuse.R float 1 1, direct_specular.B float 1 1, direct_specular.G float 1 1, direct_specular.R float 1 1, maskChannel float 1 1, sss.B float 1 1, sss.G float 1 1, sss.R float 1 1
I don't know if this file should be treated as having multiple images (including a mask image attached to one of the ordinary images), or a single image with 14 channels, or something else.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by fmw42 »

If they are truly channels, then IM 7 beta can deal with more than 4 channels. See New Options regarding -channel-fx at http://imagemagick.org/script/porting.php#cli and Pixel Channels at http://imagemagick.org/script/porting.php#channels

Unfortunately, IM 7 does not seem to find these channels, either, only the RGBA channels. Not sure if identify -verbose is updated to report non-RGBA (non-CMYK) channels.

Code: Select all

im7 identify -verbose multilayer.exr
Image: multilayer.exr
  Format: EXR (High Dynamic-range (HDR))
  Class: DirectClass
  Geometry: 960x540+0+0
  Units: Undefined
  Type: TrueColorAlpha
  Endianess: Undefined
  Colorspace: RGB
  Depth: 16-bit
  Channel depth:
    Red: 16-bit
    Green: 16-bit
    Blue: 16-bit
    Alpha: 16-bit
  Channel statistics:
    Pixels: 518400
    Red:
      min: 0 (0)
      max: 195965 (2.99023)
      mean: 8483.58 (0.129451)
      standard deviation: 13600.1 (0.207523)
      kurtosis: 15.1854
      skewness: 2.66487
      entropy: 0.516026
    Green:
      min: 0 (0)
      max: 163838 (2.5)
      mean: 5180.95 (0.0790562)
      standard deviation: 11220.4 (0.171212)
      kurtosis: 16.7495
      skewness: 3.42018
      entropy: 0.523901
    Blue:
      min: 0 (0)
      max: 235772 (3.59766)
      mean: 7825.31 (0.119407)
      standard deviation: 14986.4 (0.228678)
      kurtosis: 25.8282
      skewness: 3.77341
      entropy: 0.517932
    Alpha:
      min: 0 (0)
      max: 65535 (1)
      mean: 29903.1 (0.456291)
      standard deviation: 32580.9 (0.497153)
      kurtosis: -1.96642
      skewness: 0.175505
      entropy: 0.478528
  Image statistics:
    Overall:
      min: 0 (0)
      max: 235772 (3.59766)
      mean: 12848.2 (0.196051)
      standard deviation: 19981 (0.304891)
      kurtosis: 5.60891
      skewness: 2.51387
      entropy: 0.509097
  Alpha: rgba(0,0,0,0)   #0000000000000000
  Rendering intent: Undefined
  Gamma: 1
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 960x540+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Properties:
    date:create: 2016-03-03T09:19:02-08:00
    date:modify: 2016-03-03T09:17:36-08:00
    signature: e58876b68c2455f9b84be14ed5404fe07223a7fb78abed8db15d16c60a3cd05a
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 8.196MB
  Number pixels: 518K
  Pixels per second: 1.571MB
  User time: 0.270u
  Elapsed time: 0:01.329
  Version: ImageMagick 7.0.0-0 Q16 x86_64 2016-01-30 http://www.imagemagick.org
Likewise, the magick command does not see them either.

Code: Select all

im7 magick multilayer.exr -verbose info:
Image: multilayer.exr
  Format: EXR (High Dynamic-range (HDR))
  Class: DirectClass
  Geometry: 960x540+0+0
  Units: Undefined
  Type: TrueColorAlpha
  Endianess: Undefined
  Colorspace: RGB
  Depth: 16-bit
  Channel depth:
    Red: 16-bit
    Green: 16-bit
    Blue: 16-bit
    Alpha: 16-bit
  Channel statistics:
    Pixels: 518400
    Red:
      min: 0 (0)
      max: 195965 (2.99023)
      mean: 8483.58 (0.129451)
      standard deviation: 13600.1 (0.207523)
      kurtosis: 15.1854
      skewness: 2.66487
      entropy: 0.516026
    Green:
      min: 0 (0)
      max: 163838 (2.5)
      mean: 5180.95 (0.0790562)
      standard deviation: 11220.4 (0.171212)
      kurtosis: 16.7495
      skewness: 3.42018
      entropy: 0.523901
    Blue:
      min: 0 (0)
      max: 235772 (3.59766)
      mean: 7825.31 (0.119407)
      standard deviation: 14986.4 (0.228678)
      kurtosis: 25.8282
      skewness: 3.77341
      entropy: 0.517932
    Alpha:
      min: 0 (0)
      max: 65535 (1)
      mean: 29903.1 (0.456291)
      standard deviation: 32580.9 (0.497153)
      kurtosis: -1.96642
      skewness: 0.175505
      entropy: 0.478528
  Image statistics:
    Overall:
      min: 0 (0)
      max: 235772 (3.59766)
      mean: 12848.2 (0.196051)
      standard deviation: 19981 (0.304891)
      kurtosis: 5.60891
      skewness: 2.51387
      entropy: 0.509097
  Alpha: rgba(0,0,0,0)   #0000000000000000
  Rendering intent: Undefined
  Gamma: 1
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 960x540+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Properties:
    date:create: 2016-03-03T09:19:02-08:00
    date:modify: 2016-03-03T09:17:36-08:00
    signature: e58876b68c2455f9b84be14ed5404fe07223a7fb78abed8db15d16c60a3cd05a
  Tainted: False
  Filesize: 8.196MB
  Number pixels: 518K
  Pixels per second: 1.525MB
  User time: 0.270u
  Elapsed time: 0:01.339
  Version: ImageMagick 7.0.0-0 Q16 x86_64 2016-01-30 http://www.imagemagick.org
I am pretty sure that IM 7 has no readers, yet, for any multi-channel image format with channels > 5 (CMYKA)

Is this extra information supposed to be channels or layers?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by snibgo »

In my experiments with v7 so far, at the command line I haven't successfully created any multi-channel files.

Of course, v7 isn't yet released.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by fmw42 »

kustaa:

Do you have any documentation on multi-channel EXR images -- especially, the file format?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use ImageMagick to splitt multi-channelr EXR?

Post by fmw42 »

Looks like http://www.openexr.com/openexrfilelayout.pdf contains information about Deep Data (in scanline or tile format) for multi-channel data in EXR version 2.0.
Post Reply