Skip to content

Instantly share code, notes, and snippets.

@Kassan424kh
Created May 26, 2024 18:44
Show Gist options
  • Save Kassan424kh/c2a5c75b23dd50f6bf8addea6747d775 to your computer and use it in GitHub Desktop.
Save Kassan424kh/c2a5c75b23dd50f6bf8addea6747d775 to your computer and use it in GitHub Desktop.
.rwa to .jpg converter
# pip install rawpy imageio
# python converter.py
import os
import rawpy
import imageio
def convert_arw_to_jpeg(input_file, output_file):
with rawpy.imread(input_file) as raw:
rgb_image = raw.postprocess()
imageio.imwrite(output_file, rgb_image)
def batch_convert_arw_to_jpeg(directory):
for filename in os.listdir(directory):
if filename.lower().endswith('.arw'):
input_file = os.path.join(directory, filename)
output_file = os.path.splitext(input_file)[0] + '.jpg'
convert_arw_to_jpeg(input_file, output_file)
if __name__ == "__main__":
directory = input("Enter the directory path containing ARW files: ")
batch_convert_arw_to_jpeg(directory)
print("Conversion complete.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment