diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-11-11 23:06:00 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-11-11 23:06:00 +0100 |
commit | bfa687ae55d840e45cfce1ff0126a795e05d54e3 (patch) | |
tree | 4dc5a3e5ffc863696fcc93dbfa4cced8dd80dda9 /modules/webp/webp_common.cpp | |
parent | 97a102caf6df5a56d7587f9bb08bcb00a470bc98 (diff) | |
parent | c07cd406cbe3a80869c657b1b0ce22088954cccb (diff) | |
download | redot-engine-bfa687ae55d840e45cfce1ff0126a795e05d54e3.tar.gz |
Merge pull request #84758 from timothyqiu/decompress
Fix crash when saving compressed image as JPG & WebP
Diffstat (limited to 'modules/webp/webp_common.cpp')
-rw-r--r-- | modules/webp/webp_common.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/webp/webp_common.cpp b/modules/webp/webp_common.cpp index bc34a25733..3a2ac5a90e 100644 --- a/modules/webp/webp_common.cpp +++ b/modules/webp/webp_common.cpp @@ -59,6 +59,10 @@ Vector<uint8_t> _webp_packer(const Ref<Image> &p_image, float p_quality, bool p_ compression_method = CLAMP(compression_method, 0, 6); Ref<Image> img = p_image->duplicate(); + if (img->is_compressed()) { + Error error = img->decompress(); + ERR_FAIL_COND_V_MSG(error != OK, Vector<uint8_t>(), "Couldn't decompress image."); + } if (img->detect_alpha()) { img->convert(Image::FORMAT_RGBA8); } else { |