rawkit
rawkit copied to clipboard
Add option to re-unpack image or manually invalidate unpacked data if certain options are changed
Options like rotation can affect data unpacking. This means that if we do:
with Raw(filename='somefile.raw') as raw:
raw.save(filename='somefile.ppm')
raw.options.rotation = 180
raw.save(filename='somefile_rotated.ppm')
It won't work for some filetypes / cameras (because data is already unpacked and cached after the first unpack call).
We should either invalidate the unpacked data if one of these options is used and unpack again, or have an option to force unpacking on the unpack method and any method that calls it (eg. save).
A discussion should happen about how this is done.
At the moment, it looks like we'd have to close / open the file each time it's saved. This would break the expectation in Python land of "the file is open as long as the context manager is in use".
@campaul I'm starting to think we should just document these options and let people handle the context managers / open / closing as they see fit if their camera requires it.