So, I took a deep dive into the
OpenEXR specs and made a script in Resolve that can read the OpenEXR channels without any external applications or third party modules. I usually build scripts in Lua instead of Python which means the module Igor mentioned won't work. I have nothing against Python but I like the idea of Lua since it's built into Resolve and it doesn't require installation like Python does on Windows.
After I finally had the script working for OpenEXR v2 multipart files I discover that Resolve/Fusion actually has a scriptable module for this already built-in.
It's called EXRIO, it's not documented except for a few calls in the
External Matte Saver.fuse file that BMD includes with Fusion Studio.
More info.
With the help of a hex editor and some spying in
fusionoperators.dll you can find some of the available functions. Here's a simple Lua script that prints all the parts and channels in an OpenEXR file using EXRIO.
- Code: Select all
local exr = EXRIO()
exr:ReadOpen("/Users/rogmag/Downloads/multipart.0001.exr", -1) -- filename, frame
assert(exr:ReadHeader())
for part = 1, exr.NumParts do
if (exr.NumParts > 1) then
print("Part: "..select(2, exr:GetAttribute(part, "name")))
end
for _, channel in ipairs(exr:GetChannels(part)) do
print(" Channel: "..channel.Name)
end
end
assert(exr:Close())
Be aware that scripting EXRIO in Resolve is extremely volatile, if you make a mistake Resolve simply quits immediately. But it beats rolling your own like I first did. Oh well, at least I learned a lot about the file format.