Compare commits

..

17 Commits

Author SHA1 Message Date
55227815d5 GIT_SILENT Upgrade ECM and KF version requirements for 5.107.0 release. 2023-06-03 09:46:49 +00:00
64d51ed610 pcx: multiple fixes (2)
- 1-bit writer: checks where is black and use NOT operator only if needed
- Fix images with witdh == 65536(*)
- Checks result of disk writes and reads on all formats

(*) PCX formats support images with with of 65536 but only if the header field bytesPerLine is valid (no overflow). This means that the width 65536 is supported on 1bpp images only.
The previous version of the plugins wrote an image with width of 65536px in the wrong way and it was unable to read it (wrong image returned). I verified that Photoshop and Gimp weren't able to read the image either.

(cherry picked from commit d57ff91f8b)
2023-05-25 23:58:42 +02:00
2ca57c9c59 Avoid unnecessary conversions
(cherry picked from commit edd6adcbac)
2023-05-25 23:58:42 +02:00
f7fd14d418 RGB/SGI writer: fix alpha detection and image limit size
(cherry picked from commit d787c12727)
2023-05-25 23:58:42 +02:00
c9aa1ff629 TGA writer: fix alpha detection and performance improvements
(cherry picked from commit c9fec5e408)
2023-05-25 23:58:42 +02:00
91d3bd5227 pcx: multiple fixes
- Fix wrong RGB channel order if image format is other than (A)RGB32
- Write right resolution
- Set right resolution on image load
- Return false on write error
- Save images with depth greater than 24-bits

(cherry picked from commit e60dfd4968)
2023-05-25 23:58:42 +02:00
bb66367bc8 PCX: Fix reading of the extended palette
The VGA palette starts 769 bytes before the end of the file. There may be PADs between the end of the image and the start of the palette.

BUG: 463951
(cherry picked from commit 14742cb502)
2023-05-25 23:58:42 +02:00
14770318a3 GIT_SILENT Upgrade ECM and KF version requirements for 5.106.0 release. 2023-05-06 09:25:52 +00:00
9b1fafe29b Fix wrong alpha conversion
and use tif for image comparison in this particular one instead of png

BUG: 468288
2023-04-12 20:34:33 +00:00
fa673b5df8 GIT_SILENT Upgrade ECM and KF version requirements for 5.105.0 release. 2023-03-31 09:08:23 +00:00
e96b43aef5 psd: Fix alpha blending (KF5)
PSD files are saved with as alpha premultiplied. The problem is that alpha refers to white instead of black so it requires transformation formulas. Then, to conver PS premultiplied to QImage premultiplied you have to use the following formula:

* V = Alpha + Vps - Max (C, M, Y, K, R, G, B, Gray, L\* components)
* V = Vps + (Alpha - Max + 1) / 2 (a\*, b\* components)

Where Max is the maximum value depending on the image depth and Vps is the valued read from the file.

This is a port of MR !143 to KF5.
2023-03-29 17:58:09 +00:00
64f3303ef0 GIT_SILENT Upgrade ECM and KF version requirements for 5.104.0 release. 2023-03-04 10:04:16 +00:00
63056c52f9 GIT_SILENT Upgrade ECM and KF version requirements for 5.103.0 release. 2023-02-05 09:22:42 +00:00
2997f7ae8d psd: conversion speed improvements (kf5)
- Improved performance converting CMYK files by \~10% by replacing divisions with multiplications.
- Improved performance converting LAB files by \~50% by replacing std::pow with fastPow (approximated pow function).
2023-02-03 20:55:49 +00:00
0b4741f4b7 Fix writing TGA alpha depth flag
Correctly write alpha channel depth as 8-bit.

(cherry picked from commit 20cec27ae8)
2023-02-02 01:11:32 +01:00
bc52c03981 HDR support removed from RAW plugin 2023-01-30 21:59:09 +00:00
c1c57d9a11 heif: reject invalid files with zero size 2023-01-29 16:21:01 +01:00
146 changed files with 1046 additions and 3644 deletions

View File

@ -2,9 +2,13 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
include: include:
- project: sysadmin/ci-utilities - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
file: - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-static.yml
- /gitlab-templates/linux-qt6.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android.yml
- /gitlab-templates/android-qt6.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
- /gitlab-templates/freebsd-qt6.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml
- /gitlab-templates/windows-qt6.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android-qt6.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows-static.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd-qt6.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows-qt6.yml

View File

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16)
project(KImageFormats) project(KImageFormats)
include(FeatureSummary) include(FeatureSummary)
find_package(ECM 6.0.0 NO_MODULE) find_package(ECM 5.107.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
@ -19,11 +19,11 @@ include(ECMDeprecationSettings)
include(CheckIncludeFiles) include(CheckIncludeFiles)
include(FindPkgConfig) include(FindPkgConfig)
set(REQUIRED_QT_VERSION 6.5.0) set(REQUIRED_QT_VERSION 5.15.2)
find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) find_package(Qt${QT_MAJOR_VERSION}Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
find_package(KF6Archive) find_package(KF5Archive)
set_package_properties(KF6Archive PROPERTIES set_package_properties(KF5Archive PROPERTIES
TYPE OPTIONAL TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for Krita and OpenRaster images" PURPOSE "Required for the QImage plugin for Krita and OpenRaster images"
) )
@ -32,12 +32,12 @@ set_package_properties(KF6Archive PROPERTIES
# this available in PATH # this available in PATH
set(BUILD_EPS_PLUGIN FALSE) set(BUILD_EPS_PLUGIN FALSE)
if (UNIX) if (UNIX)
find_package(Qt6PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE) find_package(Qt${QT_MAJOR_VERSION}PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE)
set_package_properties(Qt6PrintSupport PROPERTIES set_package_properties(Qt${QT_MAJOR_VERSION}PrintSupport PROPERTIES
PURPOSE "Required for the QImage plugin for EPS images" PURPOSE "Required for the QImage plugin for EPS images"
TYPE OPTIONAL TYPE OPTIONAL
) )
if (TARGET Qt6::PrintSupport) if (TARGET Qt${QT_MAJOR_VERSION}::PrintSupport)
set(BUILD_EPS_PLUGIN TRUE) set(BUILD_EPS_PLUGIN TRUE)
endif() endif()
endif() endif()
@ -51,10 +51,7 @@ set_package_properties(OpenEXR PROPERTIES
PURPOSE "Required for the QImage plugin for OpenEXR images" PURPOSE "Required for the QImage plugin for OpenEXR images"
) )
find_package(libavif 0.8.2 CONFIG QUIET) find_package(libavif 0.8.2 CONFIG)
if(NOT libavif_FOUND)
find_package(libavif 1 CONFIG)
endif()
set_package_properties(libavif PROPERTIES set_package_properties(libavif PROPERTIES
TYPE OPTIONAL TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for AVIF images" PURPOSE "Required for the QImage plugin for AVIF images"
@ -68,8 +65,8 @@ add_feature_info(LibHeif LibHeif_FOUND "required for the QImage plugin for HEIF/
option(KIMAGEFORMATS_JXL "Enable plugin for JPEG XL format" ON) option(KIMAGEFORMATS_JXL "Enable plugin for JPEG XL format" ON)
if(KIMAGEFORMATS_JXL) if(KIMAGEFORMATS_JXL)
pkg_check_modules(LibJXL IMPORTED_TARGET libjxl>=0.7.0) pkg_check_modules(LibJXL IMPORTED_TARGET libjxl>=0.6.1)
pkg_check_modules(LibJXLThreads IMPORTED_TARGET libjxl_threads>=0.7.0) pkg_check_modules(LibJXLThreads IMPORTED_TARGET libjxl_threads>=0.6.1)
endif() endif()
add_feature_info(LibJXL LibJXL_FOUND "required for the QImage plugin for JPEG XL images") add_feature_info(LibJXL LibJXL_FOUND "required for the QImage plugin for JPEG XL images")
@ -81,8 +78,8 @@ set_package_properties(LibRaw PROPERTIES
) )
ecm_set_disabled_deprecation_versions( ecm_set_disabled_deprecation_versions(
QT 6.5 QT 5.15.2
KF 5.102 KF 5.95
) )
add_subdirectory(src) add_subdirectory(src)
@ -91,7 +88,6 @@ if (BUILD_TESTING)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
include(ECMFeatureSummary) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT) kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)

View File

@ -1,9 +0,0 @@
Copyright (c) <year> <owner>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,11 +0,0 @@
Copyright (c) <year> <owner>.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -14,26 +14,22 @@ image formats.
The following image formats have read-only support: The following image formats have read-only support:
- Animated Windows cursors (ani) - Animated Windows cursors (ani)
- Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
- Gimp (xcf) - Gimp (xcf)
- Krita (kra) - OpenEXR (exr)
- OpenRaster (ora)
- Photoshop documents (psd, psb, pdd, psdt) - Photoshop documents (psd, psb, pdd, psdt)
- Radiance HDR (hdr) - Sun Raster (ras)
- Sun Raster (im1, im8, im24, im32, ras, sun) - Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
The following image formats have read and write support: The following image formats have read and write support:
- AV1 Image File Format (AVIF) - AV1 Image File Format (AVIF)
- Encapsulated PostScript (eps) - Encapsulated PostScript (eps)
- High Efficiency Image File Format (heif). Can be enabled with the KIMAGEFORMATS_HEIF build option.
- JPEG XL (jxl) - JPEG XL (jxl)
- OpenEXR (exr)
- Personal Computer Exchange (pcx) - Personal Computer Exchange (pcx)
- Quite OK Image format (qoi)
- SGI images (rgb, rgba, sgi, bw) - SGI images (rgb, rgba, sgi, bw)
- Softimage PIC (pic) - Softimage PIC (pic)
- Targa (tga): supports more formats than Qt's version - Targa (tga): supports more formats than Qt's version
- XView (xv)
## Contributing ## Contributing
@ -45,6 +41,10 @@ of Qt is the license. As such, if you write an imageformat plugin and
you are willing to sign the Qt Project contributor agreement, it may be you are willing to sign the Qt Project contributor agreement, it may be
better to submit the plugin directly to the Qt Project. better to submit the plugin directly to the Qt Project.
Note that the imageformat plugins provided by this module also provide a
desktop file. This is for the benefit of KImageIO in the KDE4 Support
framework.
## Duplicated Plugins ## Duplicated Plugins
The TGA plugin supports more formats than Qt's own TGA plugin; The TGA plugin supports more formats than Qt's own TGA plugin;

View File

@ -1,4 +1,7 @@
#find_package(Qt5Test ${REQUIRED_QT_VERSION} NO_MODULE)
include(ECMMarkAsTest) include(ECMMarkAsTest)
include(CMakeParseArguments)
add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../bin") add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../bin")
remove_definitions(-DQT_NO_CAST_FROM_ASCII) remove_definitions(-DQT_NO_CAST_FROM_ASCII)
@ -12,7 +15,7 @@ macro(kimageformats_read_tests)
if (NOT TARGET readtest) if (NOT TARGET readtest)
add_executable(readtest readtest.cpp) add_executable(readtest readtest.cpp)
target_link_libraries(readtest Qt6::Gui) target_link_libraries(readtest Qt${QT_MAJOR_VERSION}::Gui)
target_compile_definitions(readtest target_compile_definitions(readtest
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read") PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
ecm_mark_as_test(readtest) ecm_mark_as_test(readtest)
@ -35,7 +38,7 @@ macro(kimageformats_write_tests)
if (NOT TARGET writetest) if (NOT TARGET writetest)
add_executable(writetest writetest.cpp) add_executable(writetest writetest.cpp)
target_link_libraries(writetest Qt6::Gui) target_link_libraries(writetest Qt${QT_MAJOR_VERSION}::Gui)
target_compile_definitions(writetest target_compile_definitions(writetest
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write") PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
ecm_mark_as_test(writetest) ecm_mark_as_test(writetest)
@ -67,13 +70,12 @@ kimageformats_read_tests(
hdr hdr
pcx pcx
psd psd
qoi
ras ras
rgb rgb
tga tga
) )
if (KF6Archive_FOUND) if (KF5Archive_FOUND)
kimageformats_read_tests( kimageformats_read_tests(
kra kra
ora ora
@ -97,12 +99,6 @@ if (LibHeif_FOUND)
kimageformats_write_tests(FUZZ 1 kimageformats_write_tests(FUZZ 1
heif-nodatacheck-lossless heif-nodatacheck-lossless
) )
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.17.0")
kimageformats_read_tests(FUZZ 1
hej2
)
endif()
endif() endif()
if (LibJXL_FOUND AND LibJXLThreads_FOUND) if (LibJXL_FOUND AND LibJXLThreads_FOUND)
@ -129,7 +125,6 @@ kimageformats_read_tests(FUZZ 1
kimageformats_write_tests( kimageformats_write_tests(
pcx-lossless pcx-lossless
pic-lossless pic-lossless
qoi-lossless
rgb-lossless rgb-lossless
tga # fixme: the alpha images appear not to be written properly tga # fixme: the alpha images appear not to be written properly
) )
@ -144,11 +139,6 @@ if (OpenEXR_FOUND)
kimageformats_read_tests( kimageformats_read_tests(
exr exr
) )
# Color space conversions from sRGB to linear on saving and
# from linear to sRGB on loading result in some rounding errors.
kimageformats_write_tests(FUZZ 5
exr-nodatacheck-lossless
)
endif() endif()
if (LibRaw_FOUND) if (LibRaw_FOUND)
@ -157,19 +147,19 @@ if (LibRaw_FOUND)
) )
endif() endif()
find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET) find_package(Qt${QT_MAJOR_VERSION}Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(NOT TARGET Qt6::Test) if(NOT TARGET Qt${QT_MAJOR_VERSION}::Test)
message(STATUS "Qt6Test not found, some autotests will not be built.") message(STATUS "Qt${QT_MAJOR_VERSION}Test not found, some autotests will not be built.")
return() return()
endif() endif()
add_executable(pictest pictest.cpp) add_executable(pictest pictest.cpp)
target_link_libraries(pictest Qt6::Gui Qt6::Test) target_link_libraries(pictest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test)
ecm_mark_as_test(pictest) ecm_mark_as_test(pictest)
add_test(NAME kimageformats-pic COMMAND pictest) add_test(NAME kimageformats-pic COMMAND pictest)
add_executable(anitest anitest.cpp) add_executable(anitest anitest.cpp)
target_link_libraries(anitest Qt6::Gui Qt6::Test) target_link_libraries(anitest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test)
ecm_mark_as_test(anitest) ecm_mark_as_test(anitest)
add_test(NAME kimageformats-ani COMMAND anitest) add_test(NAME kimageformats-ani COMMAND anitest)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 KiB

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 115 KiB

View File

@ -162,13 +162,13 @@ int main(int argc, char **argv)
if (!fi.suffix().compare("png", Qt::CaseInsensitive) || !fi.suffix().compare("tif", Qt::CaseInsensitive)) { if (!fi.suffix().compare("png", Qt::CaseInsensitive) || !fi.suffix().compare("tif", Qt::CaseInsensitive)) {
continue; continue;
} }
int suffixPos = fi.filePath().size() - suffix.size(); int suffixPos = fi.filePath().count() - suffix.count();
QString inputfile = fi.filePath(); QString inputfile = fi.filePath();
QString fmt = QStringLiteral("png"); QString fmt = QStringLiteral("png");
QString expfile = fi.filePath().replace(suffixPos, suffix.size(), fmt); QString expfile = fi.filePath().replace(suffixPos, suffix.count(), fmt);
if (!QFile::exists(expfile)) { // try with tiff if (!QFile::exists(expfile)) { // try with tiff
fmt = QStringLiteral("tif"); fmt = QStringLiteral("tif");
expfile = fi.filePath().replace(suffixPos, suffix.size(), fmt); expfile = fi.filePath().replace(suffixPos, suffix.count(), fmt);
} }
QString expfilename = QFileInfo(expfile).fileName(); QString expfilename = QFileInfo(expfile).fileName();

Binary file not shown.

Binary file not shown.

View File

@ -7,7 +7,6 @@
#include <stdio.h> #include <stdio.h>
#include <QBuffer> #include <QBuffer>
#include <QColorSpace>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
@ -24,8 +23,8 @@ int main(int argc, char **argv)
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
QCoreApplication::removeLibraryPath(QStringLiteral(PLUGIN_DIR)); QCoreApplication::removeLibraryPath(QStringLiteral(PLUGIN_DIR));
QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR)); QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR));
QCoreApplication::setApplicationName(QStringLiteral("writetest")); QCoreApplication::setApplicationName(QStringLiteral("readtest"));
QCoreApplication::setApplicationVersion(QStringLiteral("1.1.0")); QCoreApplication::setApplicationVersion(QStringLiteral("1.0.0"));
QCommandLineParser parser; QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("Performs basic image conversion checking.")); parser.setApplicationDescription(QStringLiteral("Performs basic image conversion checking."));
@ -86,8 +85,8 @@ int main(int argc, char **argv)
if (parser.isSet(ignoreDataCheck)) { if (parser.isSet(ignoreDataCheck)) {
pngfile = fi.filePath(); pngfile = fi.filePath();
} else { } else {
int suffixPos = fi.filePath().size() - suffix.size(); int suffixPos = fi.filePath().count() - suffix.count();
pngfile = fi.filePath().replace(suffixPos, suffix.size(), QStringLiteral("png")); pngfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png"));
} }
QString pngfilename = QFileInfo(pngfile).fileName(); QString pngfilename = QFileInfo(pngfile).fileName();
@ -149,14 +148,6 @@ int main(int argc, char **argv)
++failed; ++failed;
continue; continue;
} }
if (reReadImage.colorSpace().isValid()) {
QColorSpace toColorSpace;
if (pngImage.colorSpace().isValid()) {
reReadImage.convertToColorSpace(pngImage.colorSpace());
} else {
reReadImage.convertToColorSpace(QColorSpace(QColorSpace::SRgb));
}
}
reReadImage = reReadImage.convertToFormat(pngImage.format()); reReadImage = reReadImage.convertToFormat(pngImage.format());
} }

View File

@ -12,4 +12,3 @@ Ignacio Castaño <castano@ludicon.com> -- DDS and PDS format reader.
Christoph Hormann <chris_hormann@gmx.de> -- HDR format read support. Christoph Hormann <chris_hormann@gmx.de> -- HDR format read support.
Michael Ritzert <kde@ritzert.de> -- JPEG 2000 format read/write support Michael Ritzert <kde@ritzert.de> -- JPEG 2000 format read/write support
Troy Unrau <troy@kde.org> -- Sun RASter read support Troy Unrau <troy@kde.org> -- Sun RASter read support
Ernest Gupik <ernestgupik@wp.pl> -- QOI format read support

View File

@ -11,10 +11,9 @@ function(kimageformats_add_plugin plugin)
message(FATAL_ERROR "kimageformats_add_plugin called without SOURCES parameter") message(FATAL_ERROR "kimageformats_add_plugin called without SOURCES parameter")
endif() endif()
qt_add_plugin(${plugin} PLUGIN_TYPE imageformats) add_library(${plugin} MODULE ${KIF_ADD_PLUGIN_SOURCES})
target_sources(${plugin} PRIVATE ${KIF_ADD_PLUGIN_SOURCES}) set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/imageformats")
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/imageformats) target_link_libraries(${plugin} Qt${QT_MAJOR_VERSION}::Gui)
target_link_libraries(${plugin} PRIVATE Qt6::Gui)
install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats) install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats)
endfunction() endfunction()
@ -22,105 +21,172 @@ endfunction()
kimageformats_add_plugin(kimg_ani SOURCES ani.cpp) kimageformats_add_plugin(kimg_ani SOURCES ani.cpp)
################################## if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES ani.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
if (TARGET avif)
kimageformats_add_plugin(kimg_avif SOURCES "avif.cpp")
target_link_libraries(kimg_avif PRIVATE "avif")
endif() endif()
################################## ##################################
if (BUILD_EPS_PLUGIN) if (TARGET avif)
if (TARGET Qt6::PrintSupport) kimageformats_add_plugin(kimg_avif SOURCES "avif.cpp")
kimageformats_add_plugin(kimg_eps SOURCES eps.cpp) target_link_libraries(kimg_avif "avif")
target_link_libraries(kimg_eps PRIVATE Qt6::PrintSupport) if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES avif.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif() endif()
endif() endif()
################################## ##################################
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES dds-qt.desktop RENAME dds.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
##################################
if (BUILD_EPS_PLUGIN)
if (TARGET Qt${QT_MAJOR_VERSION}::PrintSupport)
kimageformats_add_plugin(kimg_eps SOURCES eps.cpp)
target_link_libraries(kimg_eps Qt${QT_MAJOR_VERSION}::PrintSupport)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES eps.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
endif()
endif()
##################################
if (QT_MAJOR_VERSION STREQUAL "5")
# need this for Qt's version of the plugin
install(FILES jp2.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
##################################
if(OpenEXR_FOUND) if(OpenEXR_FOUND)
kimageformats_add_plugin(kimg_exr SOURCES exr.cpp scanlineconverter.cpp) kimageformats_add_plugin(kimg_exr SOURCES exr.cpp)
if(TARGET OpenEXR::OpenEXR) if(TARGET OpenEXR::OpenEXR)
target_link_libraries(kimg_exr PRIVATE OpenEXR::OpenEXR) target_link_libraries(kimg_exr OpenEXR::OpenEXR)
else() else()
if(OpenEXR_VERSION_STRING VERSION_LESS 2.3.0) if(OpenEXR_VERSION_STRING VERSION_LESS 2.3.0)
# Older OpenEXR versions use dynamic exception specifications, so # Older OpenEXR versions use dynamic exception specifications, so
# cannot use C++17 with them # cannot use C++17 with them
set_target_properties(kimg_exr PROPERTIES CXX_STANDARD 14) set_target_properties(kimg_exr PROPERTIES CXX_STANDARD 14)
endif() endif()
target_link_libraries(kimg_exr PRIVATE OpenEXR::IlmImf) target_link_libraries(kimg_exr OpenEXR::IlmImf)
endif() endif()
kde_target_enable_exceptions(kimg_exr PRIVATE) kde_target_enable_exceptions(kimg_exr PRIVATE)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES exr.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
endif() endif()
################################## ##################################
kimageformats_add_plugin(kimg_hdr SOURCES hdr.cpp) kimageformats_add_plugin(kimg_hdr SOURCES hdr.cpp)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES hdr.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
################################## ##################################
if (LibHeif_FOUND) if (LibHeif_FOUND)
kimageformats_add_plugin(kimg_heif SOURCES heif.cpp) kimageformats_add_plugin(kimg_heif SOURCES heif.cpp)
target_link_libraries(kimg_heif PRIVATE PkgConfig::LibHeif) target_link_libraries(kimg_heif PkgConfig::LibHeif)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES heif.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
endif() endif()
################################## ##################################
if (LibJXL_FOUND AND LibJXLThreads_FOUND) if (LibJXL_FOUND AND LibJXLThreads_FOUND)
kimageformats_add_plugin(kimg_jxl SOURCES jxl.cpp) kimageformats_add_plugin(kimg_jxl SOURCES jxl.cpp)
target_link_libraries(kimg_jxl PRIVATE PkgConfig::LibJXL PkgConfig::LibJXLThreads) target_link_libraries(kimg_jxl PkgConfig::LibJXL PkgConfig::LibJXLThreads)
if (LibJXL_VERSION VERSION_GREATER_EQUAL "0.7.0")
target_compile_definitions(kimg_jxl PRIVATE KIMG_JXL_API_VERSION=70)
endif()
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES jxl.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
endif() endif()
################################## ##################################
kimageformats_add_plugin(kimg_pcx SOURCES pcx.cpp) kimageformats_add_plugin(kimg_pcx SOURCES pcx.cpp)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES pcx.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
################################## ##################################
kimageformats_add_plugin(kimg_pic SOURCES pic.cpp) kimageformats_add_plugin(kimg_pic SOURCES pic.cpp)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES pic.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
################################## ##################################
kimageformats_add_plugin(kimg_psd SOURCES psd.cpp) kimageformats_add_plugin(kimg_psd SOURCES psd.cpp)
if (QT_MAJOR_VERSION STREQUAL "5")
################################## install(FILES psd.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
kimageformats_add_plugin(kimg_qoi SOURCES qoi.cpp scanlineconverter.cpp)
################################## ##################################
kimageformats_add_plugin(kimg_ras SOURCES ras.cpp) kimageformats_add_plugin(kimg_ras SOURCES ras.cpp)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES ras.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
################################## ##################################
kimageformats_add_plugin(kimg_rgb SOURCES rgb.cpp) kimageformats_add_plugin(kimg_rgb SOURCES rgb.cpp)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES rgb.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
################################## ##################################
kimageformats_add_plugin(kimg_tga SOURCES tga.cpp) kimageformats_add_plugin(kimg_tga SOURCES tga.cpp)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES tga.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
################################## ##################################
kimageformats_add_plugin(kimg_xcf SOURCES xcf.cpp) kimageformats_add_plugin(kimg_xcf SOURCES xcf.cpp)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES xcf.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
################################## ##################################
if (LibRaw_FOUND) if (LibRaw_FOUND)
kimageformats_add_plugin(kimg_raw SOURCES raw.cpp) kimageformats_add_plugin(kimg_raw SOURCES raw.cpp)
kde_enable_exceptions() kde_enable_exceptions()
target_link_libraries(kimg_raw PRIVATE LibRaw::LibRaw) target_link_libraries(kimg_raw LibRaw::LibRaw)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES raw.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
endif() endif()
################################## ##################################
if (KF6Archive_FOUND) if (KF5Archive_FOUND)
kimageformats_add_plugin(kimg_kra SOURCES kra.cpp) kimageformats_add_plugin(kimg_kra SOURCES kra.cpp)
target_link_libraries(kimg_kra PRIVATE KF6::Archive) target_link_libraries(kimg_kra KF5::Archive)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES kra.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
kimageformats_add_plugin(kimg_ora SOURCES ora.cpp) kimageformats_add_plugin(kimg_ora SOURCES ora.cpp)
target_link_libraries(kimg_ora PRIVATE KF6::Archive) target_link_libraries(kimg_ora KF5::Archive)
if (QT_MAJOR_VERSION STREQUAL "5")
install(FILES ora.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
endif()
endif() endif()

View File

@ -90,7 +90,7 @@ bool ANIHandler::read(QImage *outImage)
} }
const QByteArray frameSizeData = device()->read(sizeof(quint32_le)); const QByteArray frameSizeData = device()->read(sizeof(quint32_le));
if (frameSizeData.size() != sizeof(quint32_le)) { if (frameSizeData.count() != sizeof(quint32_le)) {
return false; return false;
} }
@ -383,8 +383,8 @@ bool ANIHandler::ensureScanned() const
// TODO should we check that the number of rate entries matches nSteps? // TODO should we check that the number of rate entries matches nSteps?
auto *dataPtr = data.data(); auto *dataPtr = data.data();
QList<int> list; QVector<int> list;
for (int i = 0; i < data.size(); i += sizeof(quint32_le)) { for (int i = 0; i < data.count(); i += sizeof(quint32_le)) {
const auto entry = *(reinterpret_cast<const quint32_le *>(dataPtr + i)); const auto entry = *(reinterpret_cast<const quint32_le *>(dataPtr + i));
list.append(entry); list.append(entry);
} }
@ -570,5 +570,3 @@ QImageIOHandler *ANIPlugin::create(QIODevice *device, const QByteArray &format)
handler->setFormat(format); handler->setFormat(format);
return handler; return handler;
} }
#include "moc_ani_p.cpp"

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=QImageIOPlugins
X-KDE-ImageFormat=ani
X-KDE-MimeType=application/x-navi-animation
X-KDE-Read=true
X-KDE-Write=false

View File

@ -41,14 +41,14 @@ private:
int m_frameCount = 0; // "physical" frames int m_frameCount = 0; // "physical" frames
int m_imageCount = 0; // logical images int m_imageCount = 0; // logical images
// Stores a custom sequence of images // Stores a custom sequence of images
QList<int> m_imageSequence; QVector<int> m_imageSequence;
// and the corresponding offsets where they are // and the corresponding offsets where they are
// since we can't read the image data sequentally in this case then // since we can't read the image data sequentally in this case then
QList<qint64> m_frameOffsets; QVector<qint64> m_frameOffsets;
qint64 m_firstFrameOffset = 0; qint64 m_firstFrameOffset = 0;
int m_displayRate = 0; int m_displayRate = 0;
QList<int> m_displayRates; QVector<int> m_displayRates;
QString m_name; QString m_name;
QString m_artist; QString m_artist;

View File

@ -16,34 +16,9 @@
#include <cfloat> #include <cfloat>
/*
Quality range - compression/subsampling
100 - lossless RGB compression
< KIMG_AVIF_QUALITY_BEST, 100 ) - YUV444 color subsampling
< KIMG_AVIF_QUALITY_HIGH, KIMG_AVIF_QUALITY_BEST ) - YUV422 color subsampling
< 0, KIMG_AVIF_QUALITY_HIGH ) - YUV420 color subsampling
< 0, KIMG_AVIF_QUALITY_LOW ) - lossy compression of alpha channel
*/
#ifndef KIMG_AVIF_DEFAULT_QUALITY
#define KIMG_AVIF_DEFAULT_QUALITY 68
#endif
#ifndef KIMG_AVIF_QUALITY_BEST
#define KIMG_AVIF_QUALITY_BEST 90
#endif
#ifndef KIMG_AVIF_QUALITY_HIGH
#define KIMG_AVIF_QUALITY_HIGH 80
#endif
#ifndef KIMG_AVIF_QUALITY_LOW
#define KIMG_AVIF_QUALITY_LOW 51
#endif
QAVIFHandler::QAVIFHandler() QAVIFHandler::QAVIFHandler()
: m_parseState(ParseAvifNotParsed) : m_parseState(ParseAvifNotParsed)
, m_quality(KIMG_AVIF_DEFAULT_QUALITY) , m_quality(52)
, m_container_width(0) , m_container_width(0)
, m_container_height(0) , m_container_height(0)
, m_rawAvifData(AVIF_DATA_EMPTY) , m_rawAvifData(AVIF_DATA_EMPTY)
@ -355,10 +330,6 @@ bool QAVIFHandler::decode_one_frame()
avifRGBImage rgb; avifRGBImage rgb;
avifRGBImageSetDefaults(&rgb, m_decoder->image); avifRGBImageSetDefaults(&rgb, m_decoder->image);
#if AVIF_VERSION >= 1000000
rgb.maxThreads = m_decoder->maxThreads;
#endif
if (m_decoder->image->depth > 8) { if (m_decoder->image->depth > 8) {
rgb.depth = 16; rgb.depth = 16;
rgb.format = AVIF_RGB_FORMAT_RGBA; rgb.format = AVIF_RGB_FORMAT_RGBA;
@ -453,7 +424,7 @@ bool QAVIFHandler::decode_one_frame()
} }
if (m_decoder->image->transformFlags & AVIF_TRANSFORM_IMIR) { if (m_decoder->image->transformFlags & AVIF_TRANSFORM_IMIR) {
#if AVIF_VERSION > 90100 && AVIF_VERSION < 1000000 #if AVIF_VERSION > 90100
switch (m_decoder->image->imir.mode) { switch (m_decoder->image->imir.mode) {
#else #else
switch (m_decoder->image->imir.axis) { switch (m_decoder->image->imir.axis) {
@ -544,17 +515,9 @@ bool QAVIFHandler::write(const QImage &image)
} }
} }
if (m_quality > 100) {
m_quality = 100;
} else if (m_quality < 0) {
m_quality = KIMG_AVIF_DEFAULT_QUALITY;
}
#if AVIF_VERSION < 1000000
int maxQuantizer = AVIF_QUANTIZER_WORST_QUALITY * (100 - qBound(0, m_quality, 100)) / 100; int maxQuantizer = AVIF_QUANTIZER_WORST_QUALITY * (100 - qBound(0, m_quality, 100)) / 100;
int minQuantizer = 0; int minQuantizer = 0;
int maxQuantizerAlpha = 0; int maxQuantizerAlpha = 0;
#endif
avifResult res; avifResult res;
bool save_grayscale; // true - monochrome, false - colors bool save_grayscale; // true - monochrome, false - colors
@ -600,15 +563,13 @@ bool QAVIFHandler::write(const QImage &image)
break; break;
} }
#if AVIF_VERSION < 1000000 // quality settings
// deprecated quality settings
if (maxQuantizer > 20) { if (maxQuantizer > 20) {
minQuantizer = maxQuantizer - 20; minQuantizer = maxQuantizer - 20;
if (maxQuantizer > 40) { // we decrease quality of alpha channel here if (maxQuantizer > 40) { // we decrease quality of alpha channel here
maxQuantizerAlpha = maxQuantizer - 40; maxQuantizerAlpha = maxQuantizer - 40;
} }
} }
#endif
if (save_grayscale && !image.hasAlphaChannel()) { // we are going to save grayscale image without alpha channel if (save_grayscale && !image.hasAlphaChannel()) { // we are going to save grayscale image without alpha channel
if (save_depth > 8) { if (save_depth > 8) {
@ -681,8 +642,8 @@ bool QAVIFHandler::write(const QImage &image)
QImage tmpcolorimage = image.convertToFormat(tmpformat); QImage tmpcolorimage = image.convertToFormat(tmpformat);
avifPixelFormat pixel_format = AVIF_PIXEL_FORMAT_YUV420; avifPixelFormat pixel_format = AVIF_PIXEL_FORMAT_YUV420;
if (m_quality >= KIMG_AVIF_QUALITY_HIGH) { if (maxQuantizer < 20) {
if (m_quality >= KIMG_AVIF_QUALITY_BEST) { if (maxQuantizer < 10) {
pixel_format = AVIF_PIXEL_FORMAT_YUV444; // best quality pixel_format = AVIF_PIXEL_FORMAT_YUV444; // best quality
} else { } else {
pixel_format = AVIF_PIXEL_FORMAT_YUV422; // high quality pixel_format = AVIF_PIXEL_FORMAT_YUV422; // high quality
@ -753,9 +714,9 @@ bool QAVIFHandler::write(const QImage &image)
if (save_depth == 8) { if (save_depth == 8) {
save_depth = 10; save_depth = 10;
if (tmpcolorimage.hasAlphaChannel()) { if (tmpcolorimage.hasAlphaChannel()) {
tmpcolorimage.convertTo(QImage::Format_RGBA64); tmpcolorimage = tmpcolorimage.convertToFormat(QImage::Format_RGBA64);
} else { } else {
tmpcolorimage.convertTo(QImage::Format_RGBX64); tmpcolorimage = tmpcolorimage.convertToFormat(QImage::Format_RGBX64);
} }
} }
@ -842,8 +803,6 @@ bool QAVIFHandler::write(const QImage &image)
avifRWData raw = AVIF_DATA_EMPTY; avifRWData raw = AVIF_DATA_EMPTY;
avifEncoder *encoder = avifEncoderCreate(); avifEncoder *encoder = avifEncoderCreate();
encoder->maxThreads = qBound(1, QThread::idealThreadCount(), 64); encoder->maxThreads = qBound(1, QThread::idealThreadCount(), 64);
#if AVIF_VERSION < 1000000
encoder->minQuantizer = minQuantizer; encoder->minQuantizer = minQuantizer;
encoder->maxQuantizer = maxQuantizer; encoder->maxQuantizer = maxQuantizer;
@ -851,17 +810,6 @@ bool QAVIFHandler::write(const QImage &image)
encoder->minQuantizerAlpha = AVIF_QUANTIZER_LOSSLESS; encoder->minQuantizerAlpha = AVIF_QUANTIZER_LOSSLESS;
encoder->maxQuantizerAlpha = maxQuantizerAlpha; encoder->maxQuantizerAlpha = maxQuantizerAlpha;
} }
#else
encoder->quality = m_quality;
if (image.hasAlphaChannel()) {
if (m_quality >= KIMG_AVIF_QUALITY_LOW) {
encoder->qualityAlpha = 100;
} else {
encoder->qualityAlpha = 100 - (KIMG_AVIF_QUALITY_LOW - m_quality) / 2;
}
}
#endif
encoder->speed = 6; encoder->speed = 6;
@ -918,7 +866,7 @@ void QAVIFHandler::setOption(ImageOption option, const QVariant &value)
if (m_quality > 100) { if (m_quality > 100) {
m_quality = 100; m_quality = 100;
} else if (m_quality < 0) { } else if (m_quality < 0) {
m_quality = KIMG_AVIF_DEFAULT_QUALITY; m_quality = 52;
} }
return; return;
default: default:
@ -1091,11 +1039,6 @@ int QAVIFHandler::loopCount() const
return 0; return 0;
} }
#if AVIF_VERSION >= 1000000
if (m_decoder->repetitionCount >= 0) {
return m_decoder->repetitionCount;
}
#endif
// Endless loop to work around https://github.com/AOMediaCodec/libavif/issues/347 // Endless loop to work around https://github.com/AOMediaCodec/libavif/issues/347
return -1; return -1;
} }
@ -1160,5 +1103,3 @@ QImageIOHandler *QAVIFPlugin::create(QIODevice *device, const QByteArray &format
handler->setFormat(format); handler->setFormat(format);
return handler; return handler;
} }
#include "moc_avif_p.cpp"

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=QImageIOPlugins
X-KDE-ImageFormat=avif
X-KDE-MimeType=image/avif
X-KDE-Read=true
X-KDE-Write=true

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=QImageIOPlugins
X-KDE-ImageFormat=dds
X-KDE-MimeType=image/x-dds
X-KDE-Read=true
X-KDE-Write=true

View File

@ -365,5 +365,3 @@ QImageIOHandler *EPSPlugin::create(QIODevice *device, const QByteArray &format)
handler->setFormat(format); handler->setFormat(format);
return handler; return handler;
} }
#include "moc_eps_p.cpp"

Some files were not shown because too many files have changed in this diff Show More