Git Product home page Git Product logo

sharpexr's Introduction

SharpEXR

C# implementation of OpenEXR file format, a high dynamic range imaging image file format created by Industrial Light and Magic (ILM).

Currently only reads single part files with uncompressed scanlines.

Example Usage

var filePath = "somefile.exr";

// load the EXR file headers and parts, but not actual pixel data
var exrFile = EXRFile.FromFile(filePath);
var part = exrFile.Parts[0];

// read pixel data for first part in file
// synchronously, slower
//part.Open(filePath);

// open part while reading pixel data in parallel
part.OpenParallel(filePath);

// get pixel data as an array of RGBA unsigned bytes,
//   auto detecting source format,
//   converted to sRGB (screen) color space,
//   premultiplying RGB values by alpha values
byte[] bytes = part.GetBytes(ImageDestFormat.PremultipliedBGRA8, GammaEncoding.sRGB);

// get pixel data as an array of BGR 16 bit floats,
//   auto detecting source format,
//   converted to Gamma color space,
//   not including alpha channel
Half[] halfs = part.GetHalfs(ChannelConfiguration.BGR, false, GammaEncoding.Gamma, false);

// get pixel data as an array of RGBA 32 bit floats,
//   auto detecting source format,
//   not converted (linear color space),
//   including alpha but not premultiplied
float[] floats = part.GetFloats(ChannelConfiguration.RGB, true, GammaEncoding.Linear, true);

// close part
part.Close();

Saving

Saving files is currently not supported.

Single-threaded Load

The project is compiled with the PARALLEL conditional set by default. Removing this conditional compilation symbol will force the library to read image scanlines sequentially instead of in parallel. This is much slower and not recommended.

sharpexr's People

Contributors

enichan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.