Convert Exr to Exr without alpha

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?".
Post Reply
g-lul
Posts: 4
Joined: 2012-11-29T03:31:20-07:00
Authentication code: 6789

Convert Exr to Exr without alpha

Post by g-lul »

Hi there !

First of all, thanks for develop this great ImageMagick tool !! I'm working as special fx supervisor and i very often use your tools to convert images !

I'm trying to convert Exr 16bit half float (without any compression) to the exact same Exr with zip compression.
The Exr's channels i'm trying to convert are RGB only but the Exr converted channels are RGBA.

Is there a way to avoid this ?
I'm on Ubuntu 10.04.4 x86, ImageMagick 6.5.7-8 and this is my (very simple) command line :
convert imageIn.exr -compress zip imageOut.exr

Thanks !

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

Re: Convert Exr to Exr without alpha

Post by fmw42 »

Are you trying to remove the alpha channel first or keep it in your output after changing compression.

if the former, try

convert input.exr -alpha off -compress zip output.exr


if the latter, then what you have should work. Or try


convert input.exr -alpha on -channel rgba -compress zip output.exr
Last edited by fmw42 on 2012-12-06T10:51:11-07:00, edited 1 time in total.
g-lul
Posts: 4
Joined: 2012-11-29T03:31:20-07:00
Authentication code: 6789

Re: Convert Exr to Exr without alpha

Post by g-lul »

Hi !

Thanks for your answer. I'm not trying to remove or add alpha channel at all.
My source Exr file has only RGB channels but when i convert it, IM creates an RGBA Exr file, even with the -alpha off parameter (that i've tested before post message here).
I've also tried to indicate channels with -channel rgb but it didn't work.

Exr info before convert :

Code: Select all

imageIn.exr : 2560 x 1350, 3 channel, half openexr
    channel list: R, G, B
    oiio:ColorSpace: "Linear"
    compression: "none"
    PixelAspectRatio: 1
    screenWindowWidth: 1
Exr info after convert :

Code: Select all

imageOut.exr : 2560 x 1350, 4 channel, half openexr
    channel list: R, G, B, A
    oiio:ColorSpace: "Linear"
    compression: "zip"
    PixelAspectRatio: 1
    screenWindowWidth: 1
Note that alpha channel of the result is 1.0 but i don't want this channel ! :(

Any ideas ? A bug with my version of IM/Linux ?

Thanks ! :)

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

Re: Convert Exr to Exr without alpha

Post by fmw42 »

Can you post a link to an example exr image that has this problem, so we can test with it to confirm and try to find a work around.

try

convert input.exr -compress zip miff:- | convert - -alpha off output.exr
g-lul
Posts: 4
Joined: 2012-11-29T03:31:20-07:00
Authentication code: 6789

Re: Convert Exr to Exr without alpha

Post by g-lul »

Hi

I've tried your commandline but the result is the same : an RGBA Exr file... :(

So, these are the links to the Exr files, imageIn.exr is the uncompressed RGB file, and imageOut.exr is the result of the IM convert commandline (RGBA compressed file).

http://dl.free.fr/vajQnWwTN
http://dl.free.fr/n8Py8QzSt

Thanks !

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

Re: Convert Exr to Exr without alpha

Post by fmw42 »

It appears to be a bug in the exr writing. I have tried numerous ways of disabling the alpha channel and they all work right up to the point where the resulting exr file is written. It has nothing to do with -compress zip. Note that your input exr file does have an opaque alpha channel.

identify -verbose imageIn.exr

Image: imageIn.exr
Format: EXR (High Dynamic-range (HDR))
Class: DirectClass
Geometry: 256x256+0+0
Units: Undefined
Type: PaletteAlpha
Endianess: Undefined
Colorspace: RGB
Depth: 16-bit
Channel depth:
red: 16-bit
green: 16-bit
blue: 16-bit
alpha: 1-bit
Channel statistics:
Red:
min: 6552 (0.0999771)
max: 65535 (1)
mean: 20728.7 (0.3163)
standard deviation: 14687.1 (0.22411)
kurtosis: -0.337319
skewness: 0.491351
Green:
min: 6552 (0.0999771)
max: 65535 (1)
mean: 20728.7 (0.3163)
standard deviation: 14687.1 (0.22411)
kurtosis: -0.337319
skewness: 0.491351
Blue:
min: 0 (0)
max: 32768 (0.500008)
mean: 19201.7 (0.292999)
standard deviation: 13289.5 (0.202786)
kurtosis: -1.96726
skewness: 0.0280433
Alpha:
min: 65535 (1)
max: 65535 (1)
mean: 65535 (1)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Image statistics:



Turning off the alpha channel works before saving to exr:


convert imageIn.exr -alpha off -verbose info:

Image: imageIn.exr
Format: EXR (High Dynamic-range (HDR))
Class: DirectClass
Geometry: 256x256+0+0
Units: Undefined
Type: Palette
Endianess: Undefined
Colorspace: RGB
Depth: 16-bit
Channel depth:
red: 16-bit
green: 16-bit
blue: 16-bit
Channel statistics:
Red:
min: 6552 (0.0999771)
max: 65535 (1)
mean: 20728.7 (0.3163)
standard deviation: 14687.1 (0.22411)
kurtosis: -0.337319
skewness: 0.491351
Green:
min: 6552 (0.0999771)
max: 65535 (1)
mean: 20728.7 (0.3163)
standard deviation: 14687.1 (0.22411)
kurtosis: -0.337319
skewness: 0.491351
Blue:
min: 0 (0)
max: 32768 (0.500008)
mean: 19201.7 (0.292999)
standard deviation: 13289.5 (0.202786)
kurtosis: -1.96726
skewness: 0.0280433
Image statistics:

But once it is saved, the opaque alpha is enabled.

convert imageIn.exr -alpha off tmp.exr
identify -verbose tmp.exr

Image: tmp.exr
Format: EXR (High Dynamic-range (HDR))
Class: DirectClass
Geometry: 256x256+0+0
Units: Undefined
Type: PaletteAlpha
Endianess: Undefined
Colorspace: RGB
Depth: 16-bit
Channel depth:
red: 16-bit
green: 16-bit
blue: 16-bit
alpha: 1-bit
Channel statistics:
Red:
min: 6552 (0.0999771)
max: 65535 (1)
mean: 20728.7 (0.3163)
standard deviation: 14687.1 (0.22411)
kurtosis: -0.337319
skewness: 0.491351
Green:
min: 6552 (0.0999771)
max: 65535 (1)
mean: 20728.7 (0.3163)
standard deviation: 14687.1 (0.22411)
kurtosis: -0.337319
skewness: 0.491351
Blue:
min: 0 (0)
max: 32768 (0.500008)
mean: 19201.7 (0.292999)
standard deviation: 13289.5 (0.202786)
kurtosis: -1.96726
skewness: 0.0280433
Alpha:
min: 65535 (1)
max: 65535 (1)
mean: 65535 (1)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0

Image statistics:


I believe this is a bug. Please report this on the Bugs forum and put a link back to this discussion.
Post Reply