so-rose / convmlv

A feature-rich RAW developer for Magic Lantern formats.
https://git.sofusrose.com/so-rose/convmlv
GNU General Public License v3.0
15 stars 0 forks source link

libraw Developer #17

Closed so-rose closed 7 years ago

so-rose commented 7 years ago

The rawkit module gives incredible flexibility, exposed via Python, to completely throw out dcraw if I want. The functionality is the exact same, except it's exposed via python. Example of development from 'test.dng' to 'devTest.exr', using openlut's file IO:

import sys

sys.path.append('/home/sofus/subhome/src/openlut')
import openlut as ol

from rawkit.raw import Raw
from rawkit.options import WhiteBalance, interpolation

with Raw(filename='test.dng') as raw :
    raw.options.white_balance = WhiteBalance(camera=False, auto=True)
    raw.options.auto_brightness = False
    raw.options.gamma = (1, 1)
    raw.options.interpolation = interpolation.linear
    raw.options.bps = 16

    width = raw.metadata.width
    height = raw.metadata.height

    img = ol.ColMap.fromBinary(bytes(raw.to_buffer()), fmt="RGB", width=width, height=height)

img.save('devTest.exr')

dcraw works well right now, however; since convmlv is a bash application, there's no good reason to outsource dcraw's functions to what ends up being an identically python script.