openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] newbie questions: alpha-only files and linear conver


From: Florian Kainz
Subject: Re: [Openexr-devel] newbie questions: alpha-only files and linear conversion on save
Date: Thu, 20 Jan 2005 12:04:48 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314

1) Using the RGBA-only interface, one way to write an alpha-only
   image is to open the file like this:

        RgbaOutputFile file (fileName, width, height, WRITE_A);

   With the general (arbitrary set of channels) interface, you can
   open an alpha-only file like this:

        Header header (width, height);
        header.channels().insert ("A", Channel (HALF));
        OutputFile file (fileName, header);

2) 8-bit (0-255) pixel data are typically not linear in the sense
   that the amount of light represented by the pixel is proportional
   to the number stored in the pixel.  8-bit pixel data are usually
   gamma-corrected; the amount of light represented by  a pixel with
   value v is roughly proportional to pow(v,gamma), where gamma is
   about 2.2.  (For details see Charle's Poynton's Gamma FAQ at
   http://www.poynton.com/GammaFAQ.html.)

   OpenEXR expects pixel data to be linear.  In order to convert
   8-bit pixels to OpenEXR's "half" you should linearize the data:

        half h = pow (v, 1/gamma) / 255.0;

   Note that this may apply only to RGB data.  In many file formats
   alpha is linear.  The opacity represented by the alpha channel
   is proportional to the 8-bit value stored in the pixel.


Paul Miller wrote:
Hi guys. I'm adding EXR support to our up-coming cross-platform rotoscoping system (Silhouette Roto).

I have two questions:

1) what is the proper way to set up the header for an "alpha-only" image?

2) when saving generic linear color data (ie. 0-255), is it sufficient to just normalize to 0-1 and stuff the components into the output half types? This seems to work ok when reading the image back in, as long as I adjust the gamma to 1.0. If I should apply the output gamma correction, can someone post a code snippet?

Thanks!




_______________________________________________
Openexr-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/openexr-devel








reply via email to

[Prev in Thread] Current Thread [Next in Thread]