Subida de código

This commit is contained in:
2026-07-20 14:42:39 +02:00
parent f0153ca8e8
commit 6ae2dba12b
6 changed files with 132 additions and 24 deletions
+22
View File
@@ -0,0 +1,22 @@
import os
import rawpy
import cv2
directory = 'arw'
for root, _, files in os.walk(directory):
for fname in files:
if fname.lower().endswith('.arw'):
in_path = os.path.join(root, fname)
out_path = os.path.splitext(in_path)[0] + '.jpg'
print(f'Convirtiendo {in_path}{out_path}')
# Lee y procesa RAW
with rawpy.imread(in_path) as raw:
rgb = raw.postprocess()
# OpenCV usa BGR por defecto
bgr = cv2.cvtColor(rgb, cv2.COLOR_RGB2BGR)
# Guarda JPG (calidad 100)
cv2.imwrite(out_path, bgr, [int(cv2.IMWRITE_JPEG_QUALITY), 100])