From 743198e89bf683141ec2ffbedd0958dec93fd826 Mon Sep 17 00:00:00 2001 From: Alberto Fanjul Date: Mon, 4 Nov 2024 00:03:53 +0100 Subject: [PATCH] Autodetect endianness on export --- raviewer/__main__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/raviewer/__main__.py b/raviewer/__main__.py index c461510..f7426a8 100644 --- a/raviewer/__main__.py +++ b/raviewer/__main__.py @@ -12,9 +12,9 @@ import logging from .src.core import (get_displayable, load_image, parse_image) from .src.utils import save_image_as_file -from .image.color_format import AVAILABLE_FORMATS +from .image.color_format import AVAILABLE_FORMATS, Endianness from .gui.gui_init import AppInit -from .format_recognition.detect import classify_top1, predict_resolution +from .format_recognition.detect import classify_top1, classify_all, predict_resolution from tests import test_formats @@ -66,7 +66,8 @@ def run(file_path, width, height, color_format, export, args): color_format, _ = classify_top1(img) if width == 0: width, _ = predict_resolution(img, color_format)[0] - img = parse_image(img.data_buffer, color_format, width) + predictions, endianness = classify_all(img) + img = parse_image(img.data_buffer, color_format, width, Endianness[endianness].value) if height < 1: height = img.height save_image_as_file(get_displayable(img, height), export)