From 4fd0a69d7ba86e92390c421a745c6f32f1050c31 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Thu, 24 Mar 2022 18:24:06 -0400 Subject: ImBuf: Add support for WebP image format Currently only supports single image frames (no animation possible). If quality slider is set to 100 then lossless compression will be used, otherwise lossy compression is used. Gives about 35% reduction of filesize save when re-saving splash screens with lossless compression. Also saves much faster, up to 15x faster than PNG with a better compression ratio as a plus. Note, this is currently left disabled until we have WebP libs (see T95206) For testing precompiled libs can be downloaded from Google: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html Differential Revision: https://developer.blender.org/D1598 --- source/blender/makesrna/intern/CMakeLists.txt | 4 ++++ source/blender/makesrna/intern/rna_scene.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 4e3a4aae727..9980545c19d 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -236,6 +236,10 @@ if(WITH_IMAGE_HDR) add_definitions(-DWITH_HDR) endif() +if(WITH_IMAGE_WEBP) + add_definitions(-DWITH_WEBP) +endif() + if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 8172a511eb0..6be2c361ba9 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -330,6 +330,13 @@ const EnumPropertyItem rna_enum_curve_fit_method_items[] = { # define R_IMF_ENUM_TIFF #endif +#ifdef WITH_WEBP +# define R_IMF_ENUM_WEBP \ + {R_IMF_IMTYPE_WEBP, "WEBP", ICON_FILE_IMAGE, "WebP", "Output image in WebP format"}, +#else +# define R_IMF_ENUM_WEBP +#endif + #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \ R_IMF_ENUM_BMP \ /* DDS save not supported yet R_IMF_ENUM_DDS */ \ @@ -340,7 +347,7 @@ const EnumPropertyItem rna_enum_curve_fit_method_items[] = { R_IMF_ENUM_TAGA \ R_IMF_ENUM_TAGA_RAW{0, "", 0, " ", NULL}, \ R_IMF_ENUM_CINEON R_IMF_ENUM_DPX R_IMF_ENUM_EXR_MULTILAYER R_IMF_ENUM_EXR R_IMF_ENUM_HDR \ - R_IMF_ENUM_TIFF + R_IMF_ENUM_TIFF R_IMF_ENUM_WEBP #ifdef RNA_RUNTIME static const EnumPropertyItem image_only_type_items[] = { -- cgit v1.2.3