From 9100d20fa86bc07c600dc67c9a0df2d678d492f2 Mon Sep 17 00:00:00 2001 From: tiritibambix Date: Sat, 11 Jan 2025 22:58:04 +0100 Subject: [PATCH] Refonte des formats --- app.py | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 620fd02..f30d326 100644 --- a/app.py +++ b/app.py @@ -109,6 +109,33 @@ def get_available_formats(): def get_format_categories(): """Categorize image formats by their typical usage.""" return { + 'raw': { + 'recommended': [ + 'ARW', # Sony + 'CR2', 'CR3', # Canon + 'NEF', 'NRW', # Nikon + 'RAF', # Fujifilm + 'DNG', # Adobe/Generic + 'ORF', # Olympus + 'RW2', # Panasonic + 'PEF' # Pentax + ], + 'compatible': [ + 'IIQ', # Phase One + 'KDC', # Kodak + '3FR', # Hasselblad + 'MEF', # Mamiya + 'MRW', # Minolta + 'SRF', # Sony + 'X3F', # Sigma + 'ERF', # Epson + 'CRW', # Canon (ancien) + 'BAY', # Casio + 'DCR', # Kodak + 'MOS', # Leaf + 'RWL' # Leica + ] + }, 'transparency': { 'recommended': ['PNG', 'WEBP', 'AVIF', 'HEIC', 'GIF'], 'compatible': ['TIFF', 'ICO', 'JXL', 'PSD', 'SVG', 'TGA'] @@ -116,10 +143,6 @@ def get_format_categories(): 'photo': { 'recommended': ['JPEG', 'WEBP', 'AVIF', 'HEIC', 'JXL', 'TIFF'], 'compatible': [ - # Formats RAW - 'ARW', 'CR2', 'CR3', 'NEF', 'NRW', 'ORF', 'RAF', 'RW2', 'PEF', 'DNG', - 'IIQ', 'KDC', '3FR', 'MEF', 'MRW', 'SRF', 'X3F', - # Autres formats photo 'PNG', 'BMP', 'PPM', 'JP2', 'HDR', 'EXR', 'DPX', 'MIFF', 'MNG', 'PCD', 'RGBE', 'YCbCr', 'CALS' ] @@ -139,7 +162,10 @@ def get_recommended_formats(image_type): categories = get_format_categories() available_formats = set(get_available_formats()) - if image_type['has_transparency']: + # Détermine la catégorie principale + if image_type.get('is_raw'): + category = 'raw' + elif image_type['has_transparency']: category = 'transparency' elif image_type['is_photo']: category = 'photo' @@ -184,7 +210,8 @@ def analyze_image_type(filepath): return { 'has_transparency': has_transparency, 'is_photo': is_photo, - 'original_format': None # Not relevant for batch + 'original_format': None, # Not relevant for batch + 'is_raw': filepath.lower().endswith(('.arw', '.cr2', '.cr3', '.nef', '.nrw', '.raf', '.dng', '.orf', '.rw2', '.pef')) } except Exception as e: app.logger.error(f"Error analyzing image: {e}")