From fad3cdca2a0833bba56c6efb2206ae5822bc2fba Mon Sep 17 00:00:00 2001 From: sufang Date: Mon, 5 Aug 2024 17:01:51 +0800 Subject: [PATCH] fix bug:239870 --- .../kylinimagecodec/image_load/image_load.cpp | 26 ++++++++++++++----- debian/changelog | 9 +++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/codec/kylinimagecodec/image_load/image_load.cpp b/codec/kylinimagecodec/image_load/image_load.cpp index 95ad49d..f0e6736 100644 --- a/codec/kylinimagecodec/image_load/image_load.cpp +++ b/codec/kylinimagecodec/image_load/image_load.cpp @@ -288,18 +288,32 @@ Mat KylinImageCodec::loadFreeimageFormat(const char *filename) Mat mat; FIBITMAP *dib = NULL; + QFileInfo fi(QString::fromUtf8(filename)); + QString suffix = fi.suffix(); + QString file_suffix_lower = suffix.toLower(); + QImageReader reader; + QImage res_qt; + + reader.setFileName(QString(filename)); + reader.setFormat(file_suffix_lower.toLatin1()); + reader.setAutoTransform(true); + + if(reader.imageCount() >= 0){ + res_qt = reader.read(); + if (res_qt.isNull()) { + qDebug()<<"获得图片格式失败或不支持此格式图片的读取"; + return mat; + } + } /* 获取文件格式 */ FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; fif = get_real_format(QString(filename)); if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { dib = FreeImage_Load(fif, filename, 0); - } else { - qDebug() << "获得图片格式失败或不支持此格式图片的读取"; - } - if (dib != NULL) { - /* 将FIBITMAP转换成mat */ - mat = FI2MAT(dib); + if (dib != NULL) { + mat = FI2MAT(dib); + } FreeImage_Unload(dib); } else { qDebug() << "图像加载失败"; diff --git a/debian/changelog b/debian/changelog index 558797d..e3e7615 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +kylin-photo-viewer (1.3.0.3-ok22.24) nile; urgency=medium + + * BUG号:#239870 KVE-2024-0701 + * 需求号:无 + * 其他改动说明:无 + * 影响域:无 + + -- sufang Mon, 05 Aug 2024 16:59:10 +0800 + kylin-photo-viewer (1.3.0.3-ok22.23) nile; urgency=medium * BUG号:#IAH7T6【gg-维哈柯】【次要】【看图】哈柯语言下,智能处理按钮悬浮和点击都显示为英文