diff --git a/NEWS.md b/NEWS.md index d7e9ebcaf..7119504f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -33,6 +33,8 @@ empty data as a PNG image. (Needs more debugging for a proper fix...) * See #451: libpng errors crash due to libpng setjmp/longjmp (Windows 10, release builds only) * Reported by @Masamune3210. + * Qoi: R/B channels were incorrectly swapped when this was first added in v2.5. + * Affects: v2.5 - v2.5.1 * Other changes: * rpcli: Added more colorization for warning messages. diff --git a/src/librptexture/fileformat/Qoi.cpp b/src/librptexture/fileformat/Qoi.cpp index b1c899362..24276b6ad 100644 --- a/src/librptexture/fileformat/Qoi.cpp +++ b/src/librptexture/fileformat/Qoi.cpp @@ -162,7 +162,14 @@ rp_image_const_ptr QoiPrivate::loadImage(void) px_src += src_stride; } free(pixels); - + + // NOTE: qoi.h has the R and B channels swapped compared to what rp_image expects. + int ret = tmp_img->swizzle("bgra"); + if (ret != 0) { + // Swizzle failed. + return {}; + } + img.reset(tmp_img); return img; }