From 97d4577285f5f7a75f663559a6a3ad6c692c087a Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Thu, 20 Jan 2022 18:30:28 +0100 Subject: glTF exporter: Better jpeg image detection --- io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py') diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py index 8e441f9c..baee02bd 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py @@ -261,5 +261,8 @@ def __get_tex_from_socket(blender_shader_socket: bpy.types.NodeSocket, export_se def __is_blender_image_a_jpeg(image: bpy.types.Image) -> bool: if image.source != 'FILE': return False - path = image.filepath_raw.lower() - return path.endswith('.jpg') or path.endswith('.jpeg') or path.endswith('.jpe') + if image.filepath_raw == '' and image.packed_file: + return image.packed_file.data[:3] == b'\xff\xd8\xff' + else: + path = image.filepath_raw.lower() + return path.endswith('.jpg') or path.endswith('.jpeg') or path.endswith('.jpe') -- cgit v1.2.3