From 44a17e9a36d534245d95dd8b2b7449ed6e2d4724 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Fri, 19 Jul 2024 22:53:12 +0800 Subject: [PATCH] QJpegPlugin: also recognize jfif suffix Currently QJpegPlugin can load JFIF image without issue, but didn't register jfif as recognized suffix. This add the support for jfif suffix and will load the image as regular JPEG image. Qt image formats plugins doesn't care about the extra metadata provided by image itself, so it's fine to simply use the existing QJpegPlugin to load JFIF image files. Change-Id: I880d7603f356fbb01af7de8e4fb62fa010a0fd1f Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 68f58ce198a794e7b2890f1127c99e0395d105a5) --- src/plugins/imageformats/jpeg/jpeg.json | 4 ++-- src/plugins/imageformats/jpeg/main.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/imageformats/jpeg/jpeg.json b/src/plugins/imageformats/jpeg/jpeg.json index 5e26a97206..eb61296492 100644 --- a/src/plugins/imageformats/jpeg/jpeg.json +++ b/src/plugins/imageformats/jpeg/jpeg.json @@ -1,4 +1,4 @@ { - "Keys": [ "jpg", "jpeg" ], - "MimeTypes": [ "image/jpeg", "image/jpeg" ] + "Keys": [ "jpg", "jpeg", "jfif" ], + "MimeTypes": [ "image/jpeg", "image/jpeg", "image/jpeg" ] } diff --git a/src/plugins/imageformats/jpeg/main.cpp b/src/plugins/imageformats/jpeg/main.cpp index c869d07650..a68bd89da9 100644 --- a/src/plugins/imageformats/jpeg/main.cpp +++ b/src/plugins/imageformats/jpeg/main.cpp @@ -22,7 +22,7 @@ public: QImageIOPlugin::Capabilities QJpegPlugin::capabilities(QIODevice *device, const QByteArray &format) const { - if (format == "jpeg" || format == "jpg") + if (format == "jpeg" || format == "jpg" || format == "jfif") return Capabilities(CanRead | CanWrite); if (!format.isEmpty()) return { };