Created
August 10, 2021 08:08
-
-
Save persones/7f43665aa8f76ae2a495536e01fdd0e0 to your computer and use it in GitHub Desktop.
Convert .cr2 to .png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from PIL import Image | |
from rawkit.raw import Raw | |
filename = '/path/to/your/image.cr2' | |
raw_image = Raw(filename) | |
buffered_image = np.array(raw_image.to_buffer()) | |
image = Image.frombytes('RGB', (raw_image.metadata.width, raw_image.metadata.height), buffered_image) | |
image.save('/path/to/your/new/image.png', format='png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment