Compare commits
61 Commits
v5.246.0
...
work/qdoc-
Author | SHA1 | Date | |
---|---|---|---|
e2aaf89ec5 | |||
989a5c70d6 | |||
8588c053b6 | |||
145dedf360 | |||
2405a09e36 | |||
d02dcb064b | |||
0590c6b49d | |||
eb46f0f421 | |||
8c23e74ef6 | |||
219d9cb2c2 | |||
51921e8ee5 | |||
23e9fec869 | |||
4478bc8d2b | |||
acd6b3970c | |||
638fdfcbdd | |||
a497ab789b | |||
3590a43fc5 | |||
f5a6de7280 | |||
4c0f49295b | |||
e9da5edb9a | |||
e10f5aa9a5 | |||
14020a23d5 | |||
bb17f7bf84 | |||
b849e48ef4 | |||
81b7263d73 | |||
63e21ee5f3 | |||
06f097046c | |||
950ed43623 | |||
863c424390 | |||
bd083ff354 | |||
99663607b2 | |||
7499e3b8d4 | |||
cb5ca7fc48 | |||
4f61e3912c | |||
b8a9c75c80 | |||
4995c9cd15 | |||
a54c5e876c | |||
6c1a7ad339 | |||
c721fa481b | |||
ea15fed399 | |||
c2fabef501 | |||
5b2c190823 | |||
1b94554323 | |||
c2c12b1d7e | |||
c169296fbf | |||
29aec82e67 | |||
95ee381195 | |||
8e5951471d | |||
0710bc65f6 | |||
4be09ba419 | |||
6cbdf9cf54 | |||
7d6de20e8c | |||
b37c991e39 | |||
249046f25d | |||
9f7b1b8dee | |||
f065104b72 | |||
f34185197a | |||
9f24023ca7 | |||
8d1ef536be | |||
da8ed31aec | |||
ce8383e5fd |
12
.gitattributes
vendored
@ -1 +1,13 @@
|
|||||||
autotests/read/raw/RAW_KODAK_C330_FORMAT_NONE_YRGB.raw binary
|
autotests/read/raw/RAW_KODAK_C330_FORMAT_NONE_YRGB.raw binary
|
||||||
|
autotests/read/hdr/orientation1.hdr binary
|
||||||
|
autotests/read/hdr/orientation2.hdr binary
|
||||||
|
autotests/read/hdr/orientation3.hdr binary
|
||||||
|
autotests/read/hdr/orientation4.hdr binary
|
||||||
|
autotests/read/hdr/orientation5.hdr binary
|
||||||
|
autotests/read/hdr/orientation6.hdr binary
|
||||||
|
autotests/read/hdr/orientation7.hdr binary
|
||||||
|
autotests/read/hdr/orientation8.hdr binary
|
||||||
|
autotests/read/hdr/fake_earth.hdr binary
|
||||||
|
autotests/read/hdr/rgb.hdr binary
|
||||||
|
autotests/read/hdr/rgb-landscape.hdr binary
|
||||||
|
autotests/read/hdr/rgb-portrait.hdr binary
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Dependencies:
|
Dependencies:
|
||||||
- 'on': ['Linux', 'FreeBSD', 'macOS', 'Windows']
|
- 'on': ['Linux', 'FreeBSD', 'macOS', 'Windows', 'Android']
|
||||||
'require':
|
'require':
|
||||||
'frameworks/extra-cmake-modules': '@same'
|
'frameworks/extra-cmake-modules': '@same'
|
||||||
'frameworks/karchive' : '@same'
|
'frameworks/karchive' : '@same'
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(KImageFormats)
|
set(KF_VERSION "6.7.0") # handled by release scripts
|
||||||
|
set(KF_DEP_VERSION "6.6.0") # handled by release scripts
|
||||||
|
project(KImageFormats VERSION ${KF_VERSION})
|
||||||
|
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
find_package(ECM 5.240.0 NO_MODULE)
|
find_package(ECM 6.6.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)
|
||||||
|
|
||||||
@ -22,7 +24,7 @@ include(FindPkgConfig)
|
|||||||
set(REQUIRED_QT_VERSION 6.5.0)
|
set(REQUIRED_QT_VERSION 6.5.0)
|
||||||
find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
||||||
|
|
||||||
find_package(KF6Archive)
|
find_package(KF6Archive ${KF_DEP_VERSION})
|
||||||
set_package_properties(KF6Archive PROPERTIES
|
set_package_properties(KF6Archive 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"
|
||||||
@ -73,13 +75,18 @@ if(KIMAGEFORMATS_JXL)
|
|||||||
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")
|
||||||
|
|
||||||
# note: module FindLibRaw missing from https://invent.kde.org/frameworks/extra-cmake-modules
|
|
||||||
find_package(LibRaw 0.20.2)
|
find_package(LibRaw 0.20.2)
|
||||||
set_package_properties(LibRaw PROPERTIES
|
set_package_properties(LibRaw PROPERTIES
|
||||||
TYPE OPTIONAL
|
TYPE OPTIONAL
|
||||||
PURPOSE "Required for the QImage plugin for RAW images"
|
PURPOSE "Required for the QImage plugin for RAW images"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(KIMAGEFORMATS_JXR "Enable plugin for JPEG XR format" OFF)
|
||||||
|
if(KIMAGEFORMATS_JXR)
|
||||||
|
find_package(LibJXR)
|
||||||
|
endif()
|
||||||
|
add_feature_info(LibJXR LibJXR_FOUND "required for the QImage plugin for JPEG XR images")
|
||||||
|
|
||||||
ecm_set_disabled_deprecation_versions(
|
ecm_set_disabled_deprecation_versions(
|
||||||
QT 6.5
|
QT 6.5
|
||||||
KF 5.102
|
KF 5.102
|
||||||
@ -91,6 +98,7 @@ if (BUILD_TESTING)
|
|||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
include(ECMFeatureSummary)
|
||||||
|
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)
|
||||||
|
164
README.md
@ -1,6 +1,6 @@
|
|||||||
# KImageFormats
|
# KImageFormats
|
||||||
|
|
||||||
Plugins to allow QImage to support extra file formats.
|
Plugins to allow `QImage` to support extra file formats.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
@ -18,16 +18,19 @@ The following image formats have read-only support:
|
|||||||
- Gimp (xcf)
|
- Gimp (xcf)
|
||||||
- Krita (kra)
|
- Krita (kra)
|
||||||
- OpenRaster (ora)
|
- OpenRaster (ora)
|
||||||
|
- Pixar raster (pxr)
|
||||||
|
- Portable FloatMap (pfm)
|
||||||
- Photoshop documents (psd, psb, pdd, psdt)
|
- Photoshop documents (psd, psb, pdd, psdt)
|
||||||
- Radiance HDR (hdr)
|
- Radiance HDR (hdr)
|
||||||
- Sun Raster (im1, im8, im24, im32, ras, sun)
|
- Sun Raster (im1, im8, im24, im32, ras, sun)
|
||||||
|
|
||||||
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.
|
- High Efficiency Image File Format (heif)
|
||||||
- JPEG XL (jxl)
|
- JPEG XL (jxl)
|
||||||
|
- JPEG XR (jxr)
|
||||||
- OpenEXR (exr)
|
- OpenEXR (exr)
|
||||||
- Personal Computer Exchange (pcx)
|
- Personal Computer Exchange (pcx)
|
||||||
- Quite OK Image format (qoi)
|
- Quite OK Image format (qoi)
|
||||||
@ -37,7 +40,7 @@ The following image formats have read and write support:
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
See the QImageIOPlugin documentation for information on how to write a
|
See the [`QImageIOPlugin`](https://doc.qt.io/qt-6/qimageioplugin.html) documentation for information on how to write a
|
||||||
new plugin.
|
new plugin.
|
||||||
|
|
||||||
The main difference between this framework and the qimageformats module
|
The main difference between this framework and the qimageformats module
|
||||||
@ -65,3 +68,156 @@ This framework is licensed under the
|
|||||||
The CMake code in this framework is licensed under the
|
The CMake code in this framework is licensed under the
|
||||||
[BSD license](http://opensource.org/licenses/BSD-3-Clause).
|
[BSD license](http://opensource.org/licenses/BSD-3-Clause).
|
||||||
|
|
||||||
|
## Plugin status
|
||||||
|
|
||||||
|
The current implementation of a plugin may not be complete or may have limitations
|
||||||
|
of various kinds. Typically the limitations are on maximum size and color depth.
|
||||||
|
|
||||||
|
The various plugins are also limited by the formats natively supported by Qt.
|
||||||
|
For example, native support for CMYK images is only available since Qt 6.8.
|
||||||
|
|
||||||
|
### HDR images
|
||||||
|
|
||||||
|
HDR images are supported via floating point image formats from EXR, HDR, JXR,
|
||||||
|
PFM and PSD plugins.
|
||||||
|
It is important to note that in the past these plugins stripped away HDR
|
||||||
|
information, returning SDR images.
|
||||||
|
|
||||||
|
HDR images return R, G and B values outside the range 0.0 - 1.0.
|
||||||
|
While Qt painters handles HDR data correctly, some older programs may display
|
||||||
|
strange artifacts if they do not use a tone mapping operator (or at least a
|
||||||
|
clamp). This is not a plugin issue.
|
||||||
|
|
||||||
|
### Metadata
|
||||||
|
|
||||||
|
Metadata support is implemented in all formats that support it. In particular,
|
||||||
|
in addition to the classic `"Description"`, `"Author"`, `"Copyright"`, etc... where
|
||||||
|
possible, XMP data is supported via the `"XML:com.adobe.xmp"` key.
|
||||||
|
|
||||||
|
Please note that only the most common metadata is supported.
|
||||||
|
|
||||||
|
### ICC profile support
|
||||||
|
|
||||||
|
ICC support is fully implemented in all formats that support it. When saving,
|
||||||
|
some formats convert the image using color profiles according to
|
||||||
|
specifications. In particular, HDR formats almost always convert to linear
|
||||||
|
RGB.
|
||||||
|
|
||||||
|
### Maximum image size
|
||||||
|
|
||||||
|
Where possible, plugins support large images. By convention, many of the
|
||||||
|
large image plugins are limited to a maximum of 300,000 x 300,000 pixels.
|
||||||
|
Anyway, all plugins are also limited by the
|
||||||
|
`QImageIOReader::allocationLimit()`. Below are the maximum sizes for each
|
||||||
|
plugin ('n/a' means no limit, i.e. the limit depends on the format encoding).
|
||||||
|
|
||||||
|
- ANI: n/a
|
||||||
|
- AVIF: 32,768 x 32,768 pixels, in any case no larger than 256 megapixels
|
||||||
|
- EXR: 300,000 x 300,000 pixels
|
||||||
|
- HDR: n/a (large image)
|
||||||
|
- HEIF: n/a
|
||||||
|
- JXL: 65,535 x 65,535 pixels, in any case no larger than 256 megapixels
|
||||||
|
- JXR: n/a
|
||||||
|
- PCX: 65,535 x 65,535 pixels
|
||||||
|
- PFM: n/a (large image)
|
||||||
|
- PIC: 65,535 x 65,535 pixels
|
||||||
|
- PSD: 300,000 x 300,000 pixels
|
||||||
|
- PXR: 65,535 x 65,535 pixels
|
||||||
|
- QOI: 300,000 x 300,000 pixels
|
||||||
|
- RAS: n/a (large image)
|
||||||
|
- RAW: n/a (depends on the RAW format loaded)
|
||||||
|
- RGB: 65,535 x 65,535 pixels
|
||||||
|
- TGA: 65,535 x 65,535 pixels
|
||||||
|
- XCF: 300,000 x 300,000 pixels
|
||||||
|
|
||||||
|
### Sequential and random access devices
|
||||||
|
|
||||||
|
All plugins work fine on random access devices while only some work on
|
||||||
|
sequential access devices.
|
||||||
|
Some plugins, such as PSD, allow reading RGB images on sequential access
|
||||||
|
devices, but cannot do the same for Lab files.
|
||||||
|
|
||||||
|
**Important: some plugins use `QIODevice` transactions and/or
|
||||||
|
`QIODevice::ungetChar()`. Therefore, the device used to read the image must not
|
||||||
|
have any active transactions.**
|
||||||
|
|
||||||
|
### Memory usage
|
||||||
|
|
||||||
|
Qt has added many image formats over time. In older plugins, to support new
|
||||||
|
formats, `QImage` conversion functions have been used, causing memory
|
||||||
|
consumption proportional to the size of the image to be saved.
|
||||||
|
Normally this is not a source of problems because the affected plugins
|
||||||
|
are limited to maximum images of 2GiB or less.
|
||||||
|
|
||||||
|
On plugins for formats that support large images, progressive conversion has
|
||||||
|
been used or the maximum size of the image that can be saved has been limited.
|
||||||
|
|
||||||
|
### Non-RGB formats
|
||||||
|
|
||||||
|
PSD plugin loads CMYK, Lab and Multichannel images and converts them to RGB
|
||||||
|
without using the ICC profile.
|
||||||
|
|
||||||
|
JXR and PSD plugins natively support 4-channel CMYK images when compiled
|
||||||
|
with Qt 6.8+.
|
||||||
|
|
||||||
|
### The HEIF plugin
|
||||||
|
|
||||||
|
**This plugin is disabled by default. It can be enabled with the
|
||||||
|
`KIMAGEFORMATS_HEIF` build option in the cmake file.**
|
||||||
|
|
||||||
|
### The EXR plugin
|
||||||
|
|
||||||
|
The following defines can be defined in cmake to modify the behavior of the plugin:
|
||||||
|
- `EXR_CONVERT_TO_SRGB`: the linear data is converted to sRGB on read to accommodate programs that do not support color profiles.
|
||||||
|
- `EXR_DISABLE_XMP_ATTRIBUTE`: disables the stores XMP values in a non-standard attribute named "xmp". Note that Gimp reads the "xmp" attribute and Darktable writes it as well.
|
||||||
|
|
||||||
|
### The HDR plugin
|
||||||
|
|
||||||
|
The following defines can be defined in cmake to modify the behavior of the plugin:
|
||||||
|
- `HDR_HALF_QUALITY`: on read, a 16-bit float image is returned instead of a 32-bit float one.
|
||||||
|
|
||||||
|
### The JXL plugin
|
||||||
|
|
||||||
|
**The current version of the plugin limits the image size to 256 megapixels
|
||||||
|
according to feature level 5 of the JXL stream encoding.**
|
||||||
|
|
||||||
|
### The JXR plugin
|
||||||
|
|
||||||
|
**This plugin is disabled by default. It can be enabled with the
|
||||||
|
`KIMAGEFORMATS_JXR` build option in the cmake file.**
|
||||||
|
|
||||||
|
The following defines can be defined in cmake to modify the behavior of the plugin:
|
||||||
|
- `JXR_DENY_FLOAT_IMAGE`: disables the use of float images and consequently any HDR data will be lost.
|
||||||
|
- `JXR_DISABLE_DEPTH_CONVERSION`: remove the neeeds of additional memory by disabling the conversion between different color depths (e.g. RGBA64bpp to RGBA32bpp) at the cost of reduced compatibility.
|
||||||
|
- `JXR_DISABLE_BGRA_HACK`: Windows displays and opens JXR files correctly out of the box. Unfortunately it doesn't seem to open (P)RGBA @32bpp files as it only wants (P)BGRA32bpp files (a format not supported by Qt). Only for this format an hack is activated to guarantee total compatibility of the plugin with Windows.
|
||||||
|
- `JXR_ENABLE_ADVANCED_METADATA`: enable metadata support (e.g. XMP). Some distributions use an incomplete JXR library that does not allow reading metadata, causing compilation errors.
|
||||||
|
|
||||||
|
### The PSD plugin
|
||||||
|
|
||||||
|
PSD support has the following limitations:
|
||||||
|
- Only images saved by Photoshop using compatibility mode enabled (Photoshop default) can be decoded.
|
||||||
|
- Multichannel images are treated as CMY/CMYK and are only loaded if they have 3 or more channels.
|
||||||
|
- Duotone images are treated as grayscale images.
|
||||||
|
- Extra channels other than alpha are discarded.
|
||||||
|
|
||||||
|
The following defines can be defined in cmake to modify the behavior of the plugin:
|
||||||
|
- `PSD_FAST_LAB_CONVERSION`: the LAB image is converted to linear sRGB instead of sRGB which significantly increases performance.
|
||||||
|
- `PSD_NATIVE_CMYK_SUPPORT_DISABLED`: disable native support for CMYK images when compiled with Qt 6.8+
|
||||||
|
|
||||||
|
### The RAW plugin
|
||||||
|
|
||||||
|
Loading RAW images always requires a conversion. To allow the user to
|
||||||
|
choose how to convert the image, it was chosen to use the quality parameter
|
||||||
|
to act on the converter. The quality parameter can be used with values from
|
||||||
|
0 to 100 (0 = fast, 100 = maximum quality) or by setting flags to
|
||||||
|
selectively change the conversion (see also [raw_p.h](./src/imageformats/raw_p.h)).
|
||||||
|
|
||||||
|
The default setting tries to balance quality and conversion speed.
|
||||||
|
|
||||||
|
### The XCF plugin
|
||||||
|
|
||||||
|
XCF support has the following limitations:
|
||||||
|
- XCF format up to [version 12](https://testing.developer.gimp.org/core/standards/xcf/#version-history) (no support for GIMP 3).
|
||||||
|
- The returned image is always 8-bit.
|
||||||
|
- Cannot read zlib compressed files.
|
||||||
|
- The rendered image may be slightly different (colors/transparencies) than in GIMP.
|
||||||
|
@ -11,7 +11,7 @@ macro(kimageformats_read_tests)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT TARGET readtest)
|
if (NOT TARGET readtest)
|
||||||
add_executable(readtest readtest.cpp)
|
add_executable(readtest readtest.cpp templateimage.cpp)
|
||||||
target_link_libraries(readtest Qt6::Gui)
|
target_link_libraries(readtest Qt6::Gui)
|
||||||
target_compile_definitions(readtest
|
target_compile_definitions(readtest
|
||||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
|
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
|
||||||
@ -66,7 +66,9 @@ endmacro()
|
|||||||
kimageformats_read_tests(
|
kimageformats_read_tests(
|
||||||
hdr
|
hdr
|
||||||
pcx
|
pcx
|
||||||
|
pfm
|
||||||
psd
|
psd
|
||||||
|
pxr
|
||||||
qoi
|
qoi
|
||||||
ras
|
ras
|
||||||
rgb
|
rgb
|
||||||
@ -97,6 +99,12 @@ 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)
|
||||||
@ -108,6 +116,15 @@ if (LibJXL_FOUND AND LibJXLThreads_FOUND)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (LibJXR_FOUND)
|
||||||
|
kimageformats_read_tests(
|
||||||
|
jxr
|
||||||
|
)
|
||||||
|
kimageformats_write_tests(
|
||||||
|
jxr-nodatacheck
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Allow some fuzziness when reading this formats, to allow for
|
# Allow some fuzziness when reading this formats, to allow for
|
||||||
# rounding errors (eg: in alpha blending).
|
# rounding errors (eg: in alpha blending).
|
||||||
kimageformats_read_tests(FUZZ 1
|
kimageformats_read_tests(FUZZ 1
|
||||||
|
BIN
autotests/read/exr/gray.exr
Normal file
BIN
autotests/read/exr/gray.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
47
autotests/read/hdr/orientation1.hdr
Normal file
5
autotests/read/hdr/orientation1.hdr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "orientation_all.png"
|
||||||
|
}
|
||||||
|
]
|
47
autotests/read/hdr/orientation2.hdr
Normal file
5
autotests/read/hdr/orientation2.hdr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "orientation_all.png"
|
||||||
|
}
|
||||||
|
]
|
47
autotests/read/hdr/orientation3.hdr
Normal file
5
autotests/read/hdr/orientation3.hdr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "orientation_all.png"
|
||||||
|
}
|
||||||
|
]
|
47
autotests/read/hdr/orientation4.hdr
Normal file
5
autotests/read/hdr/orientation4.hdr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "orientation_all.png"
|
||||||
|
}
|
||||||
|
]
|
47
autotests/read/hdr/orientation5.hdr
Normal file
5
autotests/read/hdr/orientation5.hdr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "orientation_all.png"
|
||||||
|
}
|
||||||
|
]
|
47
autotests/read/hdr/orientation6.hdr
Normal file
5
autotests/read/hdr/orientation6.hdr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "orientation_all.png"
|
||||||
|
}
|
||||||
|
]
|
47
autotests/read/hdr/orientation7.hdr
Normal file
5
autotests/read/hdr/orientation7.hdr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "orientation_all.png"
|
||||||
|
}
|
||||||
|
]
|
47
autotests/read/hdr/orientation8.hdr
Normal file
5
autotests/read/hdr/orientation8.hdr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fileName" : "orientation_all.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/hdr/orientation_all.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
autotests/read/hej2/rgb_kcolorchooser.hej2
Normal file
BIN
autotests/read/hej2/rgb_kcolorchooser.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
autotests/read/hej2/rgba_kolourpaint.hej2
Normal file
BIN
autotests/read/hej2/rgba_kolourpaint.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
autotests/read/jxl/orientation6_notranfs.jxl
Normal file
19
autotests/read/jxl/orientation6_notranfs.jxl.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.5.7",
|
||||||
|
"maxQtVersion" : "6.5.99",
|
||||||
|
"disableAutoTransform": true,
|
||||||
|
"fileName" : "orientation6_notranfs.png",
|
||||||
|
"comment" : "Test with automatic transformation disabled."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.7.3",
|
||||||
|
"disableAutoTransform": true,
|
||||||
|
"fileName" : "orientation6_notranfs.png",
|
||||||
|
"comment" : "Test with automatic transformation disabled."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unsupportedFormat" : true,
|
||||||
|
"comment" : "It is not possible to disable the transformation with the current version of the plugin."
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/jxl/orientation6_notranfs.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
autotests/read/jxr/abydos_bgra32.jxr
Normal file
BIN
autotests/read/jxr/abydos_bgra32.png
Normal file
After Width: | Height: | Size: 206 KiB |
BIN
autotests/read/jxr/testcard_bgra8.jxr
Normal file
BIN
autotests/read/jxr/testcard_bgra8.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
autotests/read/jxr/testcard_cmyk8.jxr
Normal file
11
autotests/read/jxr/testcard_cmyk8.jxr.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.8.0",
|
||||||
|
"fileName" : "testcard_cmyk8.tif"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maxQtVersion" : "6.7.99",
|
||||||
|
"unsupportedFormat" : true,
|
||||||
|
"comment" : "Qt versions lower than 6.8 do not support CMYK format so this test should be skipped."
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/jxr/testcard_cmyk8.tif
Normal file
BIN
autotests/read/jxr/testcard_gray16.jxr
Normal file
BIN
autotests/read/jxr/testcard_gray16.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
autotests/read/jxr/testcard_gray8.jxr
Normal file
BIN
autotests/read/jxr/testcard_gray8.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
autotests/read/jxr/testcard_mono.jxr
Normal file
BIN
autotests/read/jxr/testcard_mono.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
autotests/read/jxr/testcard_rgb16.jxr
Normal file
BIN
autotests/read/jxr/testcard_rgb16.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxr/testcard_rgb8.jxr
Normal file
BIN
autotests/read/jxr/testcard_rgb8.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
autotests/read/jxr/testcard_rgba16.jxr
Normal file
BIN
autotests/read/jxr/testcard_rgba16.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
autotests/read/jxr/testcard_rgba8.jxr
Normal file
BIN
autotests/read/jxr/testcard_rgba8.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
autotests/read/pcx/16color.pcx
Normal file
BIN
autotests/read/pcx/16color.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
autotests/read/pcx/indexed4.pcx
Normal file
BIN
autotests/read/pcx/indexed4.png
Normal file
After Width: | Height: | Size: 593 B |
BIN
autotests/read/pfm/testcard_gray.pfm
Normal file
BIN
autotests/read/pfm/testcard_gray.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/pfm/testcard_rgb.pfm
Normal file
BIN
autotests/read/pfm/testcard_rgb.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
autotests/read/pfm/testcard_rgb_ps.pfm
Normal file
BIN
autotests/read/pfm/testcard_rgb_ps.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
autotests/read/psd/cmyk16_testcard.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
autotests/read/psd/cmyk16_testcard.psd
Normal file
11
autotests/read/psd/cmyk16_testcard.psd.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.8.0",
|
||||||
|
"fileName" : "cmyk16_testcard_qt6_8.tif"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.0.0",
|
||||||
|
"maxQtVersion" : "6.7.99",
|
||||||
|
"fileName" : "cmyk16_testcard.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/psd/cmyk16_testcard_qt6_8.tif
Normal file
BIN
autotests/read/psd/cmyk8_testcard.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
autotests/read/psd/cmyk8_testcard.psd
Normal file
11
autotests/read/psd/cmyk8_testcard.psd.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.8.0",
|
||||||
|
"fileName" : "cmyk8_testcard_qt6_8.tif"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.0.0",
|
||||||
|
"maxQtVersion" : "6.7.99",
|
||||||
|
"fileName" : "cmyk8_testcard.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/psd/cmyk8_testcard_qt6_8.tif
Normal file
11
autotests/read/psd/cmyka-16bits.psd.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.8.0",
|
||||||
|
"fileName" : "cmyka-16bits_qt6_8.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.0.0",
|
||||||
|
"maxQtVersion" : "6.7.99",
|
||||||
|
"fileName" : "cmyka-16bits.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/psd/cmyka-16bits_qt6_8.png
Normal file
After Width: | Height: | Size: 111 KiB |
11
autotests/read/psd/cmyka-8bits.psd.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.8.0",
|
||||||
|
"fileName" : "cmyka-8bits_qt6_8.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.0.0",
|
||||||
|
"maxQtVersion" : "6.7.99",
|
||||||
|
"fileName" : "cmyka-8bits.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/psd/cmyka-8bits_qt6_8.png
Normal file
After Width: | Height: | Size: 77 KiB |
11
autotests/read/psd/mch-16bits.psd.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.8.0",
|
||||||
|
"fileName" : "mch-16bits_qt_6_8.tif"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.0.0",
|
||||||
|
"maxQtVersion" : "6.7.99",
|
||||||
|
"fileName" : "mch-16bits.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/psd/mch-16bits_qt_6_8.tif
Normal file
11
autotests/read/psd/mch-8bits.psd.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.8.0",
|
||||||
|
"fileName" : "mch-8bits_qt_6.8.tif"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.0.0",
|
||||||
|
"maxQtVersion" : "6.7.99",
|
||||||
|
"fileName" : "mch-8bits.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/psd/mch-8bits_qt_6.8.tif
Normal file
BIN
autotests/read/pxr/testcard_gray.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
autotests/read/pxr/testcard_gray.pxr
Normal file
BIN
autotests/read/pxr/testcard_rgb.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
autotests/read/pxr/testcard_rgb.pxr
Normal file
BIN
autotests/read/rgb/testcard_rgba.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
autotests/read/rgb/testcard_rgba.rgb
Normal file
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 93 KiB |
32
autotests/read/xcf/birthday16.xcf.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.7.0",
|
||||||
|
"fileName" : "birthday16.png",
|
||||||
|
"seeAlso" : "https://bugreports.qt.io/browse/QTBUG-120614"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.0.0",
|
||||||
|
"maxQtVersion" : "6.2.10",
|
||||||
|
"fileName" : "birthday16_alphabug.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.3.0",
|
||||||
|
"maxQtVersion" : "6.3.2",
|
||||||
|
"fileName" : "birthday32_alphabug.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.4.0",
|
||||||
|
"maxQtVersion" : "6.4.3",
|
||||||
|
"fileName" : "birthday32_alphabug.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.5.0",
|
||||||
|
"maxQtVersion" : "6.5.4",
|
||||||
|
"fileName" : "birthday16_alphabug.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.6.0",
|
||||||
|
"maxQtVersion" : "6.6.1",
|
||||||
|
"fileName" : "birthday16_alphabug.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/xcf/birthday16_alphabug.png
Normal file
After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 93 KiB |
32
autotests/read/xcf/birthday32.xcf.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.7.0",
|
||||||
|
"fileName" : "birthday32.png",
|
||||||
|
"seeAlso" : "https://bugreports.qt.io/browse/QTBUG-120614"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.0.0",
|
||||||
|
"maxQtVersion" : "6.2.10",
|
||||||
|
"fileName" : "birthday32_alphabug.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.3.0",
|
||||||
|
"maxQtVersion" : "6.3.2",
|
||||||
|
"fileName" : "birthday32_alphabug.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.4.0",
|
||||||
|
"maxQtVersion" : "6.4.3",
|
||||||
|
"fileName" : "birthday32_alphabug.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.5.0",
|
||||||
|
"maxQtVersion" : "6.5.4",
|
||||||
|
"fileName" : "birthday32_alphabug.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minQtVersion" : "6.6.0",
|
||||||
|
"maxQtVersion" : "6.6.1",
|
||||||
|
"fileName" : "birthday32_alphabug.png"
|
||||||
|
}
|
||||||
|
]
|
BIN
autotests/read/xcf/birthday32_alphabug.png
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
autotests/read/xcf/bug_476755_gray_layers.png
Normal file
After Width: | Height: | Size: 234 KiB |
BIN
autotests/read/xcf/bug_476755_gray_layers.xcf
Normal file
BIN
autotests/read/xcf/bug_476755_rgb_layers.png
Normal file
After Width: | Height: | Size: 234 KiB |
BIN
autotests/read/xcf/bug_476755_rgb_layers.xcf
Normal file
@ -16,6 +16,7 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "../tests/format-enum.h"
|
#include "../tests/format-enum.h"
|
||||||
|
#include "templateimage.h"
|
||||||
|
|
||||||
#include "fuzzyeq.cpp"
|
#include "fuzzyeq.cpp"
|
||||||
|
|
||||||
@ -89,13 +90,115 @@ static QImage::Format preferredFormat(QImage::Format fmt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief The OptionTest class
|
||||||
|
* Class for testing image options.
|
||||||
|
* Supports the most common options:
|
||||||
|
* - Size
|
||||||
|
* - ImageFormat
|
||||||
|
* - ImageTransformation (rotations)
|
||||||
|
* \todo Add missing options if needed.
|
||||||
|
*/
|
||||||
|
class OptionTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OptionTest()
|
||||||
|
: m_size(QSize())
|
||||||
|
, m_format(QImage::Format_Invalid)
|
||||||
|
, m_transformations(QImageIOHandler::TransformationNone)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OptionTest(const OptionTest&) = default;
|
||||||
|
OptionTest& operator =(const OptionTest&) = default;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief store
|
||||||
|
* Stores the supported options of the reader.
|
||||||
|
* \param reader
|
||||||
|
* \return True on success, otherwise false.
|
||||||
|
*/
|
||||||
|
bool store(const QImageReader *reader = nullptr)
|
||||||
|
{
|
||||||
|
if (reader == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool ok = true;
|
||||||
|
if (reader->supportsOption(QImageIOHandler::Size)) {
|
||||||
|
m_size = reader->size();
|
||||||
|
if (m_size.isEmpty())
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
if (reader->supportsOption(QImageIOHandler::ImageFormat)) {
|
||||||
|
m_format = reader->imageFormat();
|
||||||
|
if (m_format == QImage::Format_Invalid)
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
if (reader->supportsOption(QImageIOHandler::ImageTransformation)) {
|
||||||
|
m_transformations = reader->transformation();
|
||||||
|
if (m_transformations < 0 || m_transformations > 7)
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief compare
|
||||||
|
* Compare the stored values with the ones read from the image reader.
|
||||||
|
* \param reader
|
||||||
|
* \return True on success, otherwise false.
|
||||||
|
*/
|
||||||
|
bool compare(const QImageReader *reader)
|
||||||
|
{
|
||||||
|
if (reader == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool ok = true;
|
||||||
|
if (reader->supportsOption(QImageIOHandler::Size)) {
|
||||||
|
ok = ok && (m_size == reader->size());
|
||||||
|
}
|
||||||
|
if (reader->supportsOption(QImageIOHandler::ImageFormat)) {
|
||||||
|
ok = ok && (m_format == reader->imageFormat());
|
||||||
|
}
|
||||||
|
if (reader->supportsOption(QImageIOHandler::ImageTransformation)) {
|
||||||
|
ok = ok && (m_transformations == reader->transformation());
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief compare
|
||||||
|
* Compare the image properties with the ones stored.
|
||||||
|
* \param image
|
||||||
|
* \return True on success, otherwise false.
|
||||||
|
*/
|
||||||
|
bool compare(const QImage& image)
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
if (!m_size.isEmpty()) {
|
||||||
|
// Size option return the size without transformation (tested with Qt TIFF plugin).
|
||||||
|
ok = ok && (m_size == image.size() || m_size == image.size().transposed());
|
||||||
|
}
|
||||||
|
if (m_format != QImage::Format_Invalid) {
|
||||||
|
ok = ok && (m_format == image.format());
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSize m_size;
|
||||||
|
QImage::Format m_format;
|
||||||
|
QImageIOHandler::Transformations m_transformations;
|
||||||
|
};
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
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("readtest"));
|
QCoreApplication::setApplicationName(QStringLiteral("readtest"));
|
||||||
QCoreApplication::setApplicationVersion(QStringLiteral("1.1.0"));
|
QCoreApplication::setApplicationVersion(QStringLiteral("1.2.0"));
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription(QStringLiteral("Performs basic image conversion checking."));
|
parser.setApplicationDescription(QStringLiteral("Performs basic image conversion checking."));
|
||||||
@ -159,28 +262,39 @@ int main(int argc, char **argv)
|
|||||||
QTextStream(stdout) << "* Run on RANDOM ACCESS device\n";
|
QTextStream(stdout) << "* Run on RANDOM ACCESS device\n";
|
||||||
}
|
}
|
||||||
for (const QFileInfo &fi : lstImgDir) {
|
for (const QFileInfo &fi : lstImgDir) {
|
||||||
if (!fi.suffix().compare("png", Qt::CaseInsensitive) || !fi.suffix().compare("tif", Qt::CaseInsensitive)) {
|
TemplateImage timg(fi);
|
||||||
|
if (timg.isTemplate()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int suffixPos = fi.filePath().size() - suffix.size();
|
|
||||||
QString inputfile = fi.filePath();
|
|
||||||
QString fmt = QStringLiteral("png");
|
|
||||||
QString expfile = fi.filePath().replace(suffixPos, suffix.size(), fmt);
|
|
||||||
if (!QFile::exists(expfile)) { // try with tiff
|
|
||||||
fmt = QStringLiteral("tif");
|
|
||||||
expfile = fi.filePath().replace(suffixPos, suffix.size(), fmt);
|
|
||||||
}
|
|
||||||
QString expfilename = QFileInfo(expfile).fileName();
|
|
||||||
|
|
||||||
std::unique_ptr<QIODevice> inputDevice(seq ? new SequentialFile(inputfile) : new QFile(inputfile));
|
TemplateImage::TestFlags flags = TemplateImage::None;
|
||||||
|
QString comment;
|
||||||
|
QFileInfo expFileInfo = timg.compareImage(flags, comment);
|
||||||
|
if ((flags & TemplateImage::SkipTest) == TemplateImage::SkipTest) {
|
||||||
|
if(comment.isEmpty())
|
||||||
|
comment = QStringLiteral("image format not supported by current Qt version!");
|
||||||
|
QTextStream(stdout) << "SKIP : " << fi.fileName() << QStringLiteral(": %1\n").arg(comment);
|
||||||
|
++skipped;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!formatStrings.contains(expFileInfo.suffix(), Qt::CaseInsensitive)) {
|
||||||
|
// Work Around for CCBUG: 468288
|
||||||
|
QTextStream(stdout) << "SKIP : " << fi.fileName() << ": comparison image " << expFileInfo.fileName() << " cannot be loaded due to the lack of "
|
||||||
|
<< expFileInfo.suffix().toUpper() << " plugin!\n";
|
||||||
|
++skipped;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QString expfilename = expFileInfo.fileName();
|
||||||
|
|
||||||
|
std::unique_ptr<QIODevice> inputDevice(seq ? new SequentialFile(fi.filePath()) : new QFile(fi.filePath()));
|
||||||
QImageReader inputReader(inputDevice.get(), format);
|
QImageReader inputReader(inputDevice.get(), format);
|
||||||
QImageReader expReader(expfile, fmt.toLatin1());
|
QImageReader expReader(expFileInfo.filePath());
|
||||||
|
|
||||||
QImage inputImage;
|
QImage inputImage;
|
||||||
QImage expImage;
|
QImage expImage;
|
||||||
|
|
||||||
// inputImage is auto-rotated to final orientation
|
// inputImage is auto-rotated to final orientation
|
||||||
inputReader.setAutoTransform(true);
|
inputReader.setAutoTransform((flags & TemplateImage::DisableAutotransform) != TemplateImage::DisableAutotransform);
|
||||||
|
|
||||||
if (!expReader.read(&expImage)) {
|
if (!expReader.read(&expImage)) {
|
||||||
QTextStream(stdout) << "ERROR: " << fi.fileName() << ": could not load " << expfilename << ": " << expReader.errorString() << "\n";
|
QTextStream(stdout) << "ERROR: " << fi.fileName() << ": could not load " << expfilename << ": " << expReader.errorString() << "\n";
|
||||||
@ -199,11 +313,32 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OptionTest optionTest;
|
||||||
|
if (!optionTest.store(&inputReader)) {
|
||||||
|
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": error while reading options\n";
|
||||||
|
++failed;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!inputReader.read(&inputImage)) {
|
if (!inputReader.read(&inputImage)) {
|
||||||
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": failed to load: " << inputReader.errorString() << "\n";
|
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": failed to load: " << inputReader.errorString() << "\n";
|
||||||
++failed;
|
++failed;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!optionTest.compare(&inputReader)) {
|
||||||
|
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": error while comparing options\n";
|
||||||
|
++failed;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!optionTest.compare(inputImage)) {
|
||||||
|
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": error while comparing the image properties with options\n";
|
||||||
|
++failed;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (expImage.width() != inputImage.width()) {
|
if (expImage.width() != inputImage.width()) {
|
||||||
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": width was " << inputImage.width() << " but " << expfilename << " width was "
|
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": width was " << inputImage.width() << " but " << expfilename << " width was "
|
||||||
<< expImage.width() << "\n";
|
<< expImage.width() << "\n";
|
||||||
|
111
autotests/templateimage.cpp
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
SPDX-FileCopyrightText: 2024 Mirco Miranda <mircomir@outlook.com>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "templateimage.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QVersionNumber>
|
||||||
|
|
||||||
|
TemplateImage::TemplateImage(const QFileInfo &fi) :
|
||||||
|
m_fi(fi)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TemplateImage::isTemplate() const
|
||||||
|
{
|
||||||
|
auto list = suffixes();
|
||||||
|
for (auto&& suffix : list) {
|
||||||
|
if (!m_fi.suffix().compare(suffix, Qt::CaseInsensitive))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFileInfo TemplateImage::compareImage(TestFlags &flags, QString& comment) const
|
||||||
|
{
|
||||||
|
auto fi = jsonImage(flags, comment);
|
||||||
|
if ((flags & TestFlag::SkipTest) == TestFlag::SkipTest) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
if (fi.exists()) {
|
||||||
|
return fi;
|
||||||
|
}
|
||||||
|
return legacyImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList TemplateImage::suffixes()
|
||||||
|
{
|
||||||
|
return QStringList({"png", "tif", "tiff", "json"});
|
||||||
|
}
|
||||||
|
|
||||||
|
QFileInfo TemplateImage::legacyImage() const
|
||||||
|
{
|
||||||
|
auto list = suffixes();
|
||||||
|
for (auto&& suffix : list) {
|
||||||
|
auto fi = QFileInfo(QStringLiteral("%1/%2.%3").arg(m_fi.path(), m_fi.completeBaseName(), suffix));
|
||||||
|
if (fi.exists()) {
|
||||||
|
return fi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QFileInfo TemplateImage::jsonImage(TestFlags &flags, QString& comment) const
|
||||||
|
{
|
||||||
|
flags = TestFlag::None;
|
||||||
|
auto fi = QFileInfo(QStringLiteral("%1.json").arg(m_fi.filePath()));
|
||||||
|
if (!fi.exists()) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile f(fi.filePath());
|
||||||
|
if (!f.open(QFile::ReadOnly)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonParseError err;
|
||||||
|
auto doc = QJsonDocument::fromJson(f.readAll(), &err);
|
||||||
|
if (err.error != QJsonParseError::NoError || !doc.isArray()) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto currentQt = QVersionNumber::fromString(qVersion());
|
||||||
|
auto arr = doc.array();
|
||||||
|
for (auto val : arr) {
|
||||||
|
if (!val.isObject())
|
||||||
|
continue;
|
||||||
|
auto obj = val.toObject();
|
||||||
|
auto minQt = QVersionNumber::fromString(obj.value("minQtVersion").toString());
|
||||||
|
auto maxQt = QVersionNumber::fromString(obj.value("maxQtVersion").toString());
|
||||||
|
auto name = obj.value("fileName").toString();
|
||||||
|
auto unsupportedFormat = obj.value("unsupportedFormat").toBool();
|
||||||
|
comment = obj.value("comment").toString();
|
||||||
|
|
||||||
|
if(obj.value("disableAutoTransform").toBool())
|
||||||
|
flags |= TestFlag::DisableAutotransform;
|
||||||
|
|
||||||
|
// filter
|
||||||
|
if (name.isEmpty() && !unsupportedFormat)
|
||||||
|
continue;
|
||||||
|
if (!minQt.isNull() && currentQt < minQt)
|
||||||
|
continue;
|
||||||
|
if (!maxQt.isNull() && currentQt > maxQt)
|
||||||
|
continue;
|
||||||
|
if (unsupportedFormat) {
|
||||||
|
flags |= TestFlag::SkipTest;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return QFileInfo(QStringLiteral("%1/%2").arg(fi.path(), name));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
83
autotests/templateimage.h
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
SPDX-FileCopyrightText: 2024 Mirco Miranda <mircomir@outlook.com>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TEMPLATEIMAGE_H
|
||||||
|
#define TEMPLATEIMAGE_H
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief The TemplateImage class
|
||||||
|
* Given an image name, it decides the template image to compare it with.
|
||||||
|
*/
|
||||||
|
class TemplateImage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum TestFlag {
|
||||||
|
None = 0x0,
|
||||||
|
SkipTest = 0x1,
|
||||||
|
DisableAutotransform = 0x2
|
||||||
|
};
|
||||||
|
Q_DECLARE_FLAGS(TestFlags, TestFlag)
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief TemplateImage
|
||||||
|
* \param fi The image to test.
|
||||||
|
*/
|
||||||
|
TemplateImage(const QFileInfo& fi);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief TemplateImage
|
||||||
|
* Default copy constructor.
|
||||||
|
*/
|
||||||
|
TemplateImage(const TemplateImage& other) = default;
|
||||||
|
/*!
|
||||||
|
* \brief operator =
|
||||||
|
* Default copy operator
|
||||||
|
*/
|
||||||
|
TemplateImage& operator=(const TemplateImage& other) = default;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief isTemplate
|
||||||
|
* \return True if the image is a template, false otherwise.
|
||||||
|
* \sa suffixes
|
||||||
|
*/
|
||||||
|
bool isTemplate() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief compareImage
|
||||||
|
* \param flags Flags for modifying test behavior (e.g. image format not supported by current Qt version).
|
||||||
|
* \return The template image to use for the comparison.
|
||||||
|
*/
|
||||||
|
QFileInfo compareImage(TestFlags &flags, QString& comment) const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief suffixes
|
||||||
|
* \return The list of suffixes considered templates.
|
||||||
|
*/
|
||||||
|
static QStringList suffixes();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*!
|
||||||
|
* \brief legacyImage
|
||||||
|
* \return The template image calculated from the source image name.
|
||||||
|
*/
|
||||||
|
QFileInfo legacyImage() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief jsonImage
|
||||||
|
* \param flags Flags for modifying test behavior.
|
||||||
|
* \return The template image read from the corresponding JSON.
|
||||||
|
*/
|
||||||
|
QFileInfo jsonImage(TestFlags &flags, QString& comment) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QFileInfo m_fi;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(TemplateImage::TestFlags)
|
||||||
|
|
||||||
|
#endif // TEMPLATEIMAGE_H
|
24
cmake/find-modules/FindLibJXR.cmake
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# - Find LibJXR
|
||||||
|
# Find the JXR library
|
||||||
|
# This module defines
|
||||||
|
# LIBJXR_INCLUDE_DIRS, where to find jxrlib/JXRGlue.h
|
||||||
|
# LIBJXR_LIBRARIES, the libraries needed to use JXR
|
||||||
|
#
|
||||||
|
# Based on cmake code found at https://github.com/microsoft/vcpkg/blob/master/ports/jxrlib/FindJXR.cmake
|
||||||
|
|
||||||
|
find_path(LIBJXR_INCLUDE_DIRS
|
||||||
|
NAMES JXRGlue.h
|
||||||
|
PATH_SUFFIXES jxrlib
|
||||||
|
)
|
||||||
|
mark_as_advanced(LIBJXR_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
include(SelectLibraryConfigurations)
|
||||||
|
|
||||||
|
find_library(LIBJPEGXR_LIBRARY NAMES jpegxr)
|
||||||
|
find_library(LIBJXRGLUE_LIBRARY NAMES jxrglue)
|
||||||
|
|
||||||
|
set(LIBJXR_LIBRARIES ${LIBJPEGXR_LIBRARY} ${LIBJXRGLUE_LIBRARY})
|
||||||
|
mark_as_advanced(LIBJXR_LIBRARIES)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibJXR DEFAULT_MSG LIBJXR_INCLUDE_DIRS LIBJXR_LIBRARIES)
|
@ -1,4 +1,3 @@
|
|||||||
maintainer: alexmerry
|
|
||||||
description: Image format plugins for Qt
|
description: Image format plugins for Qt
|
||||||
tier: 2
|
tier: 2
|
||||||
type: functional
|
type: functional
|
||||||
|
@ -83,7 +83,15 @@ kimageformats_add_plugin(kimg_pic SOURCES pic.cpp)
|
|||||||
|
|
||||||
##################################
|
##################################
|
||||||
|
|
||||||
kimageformats_add_plugin(kimg_psd SOURCES psd.cpp)
|
kimageformats_add_plugin(kimg_pfm SOURCES pfm.cpp)
|
||||||
|
|
||||||
|
##################################
|
||||||
|
|
||||||
|
kimageformats_add_plugin(kimg_psd SOURCES psd.cpp scanlineconverter.cpp)
|
||||||
|
|
||||||
|
##################################
|
||||||
|
|
||||||
|
kimageformats_add_plugin(kimg_pxr SOURCES pxr.cpp)
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
|
|
||||||
@ -115,6 +123,20 @@ endif()
|
|||||||
|
|
||||||
##################################
|
##################################
|
||||||
|
|
||||||
|
if (LibJXR_FOUND)
|
||||||
|
kimageformats_add_plugin(kimg_jxr SOURCES jxr.cpp)
|
||||||
|
kde_enable_exceptions()
|
||||||
|
target_include_directories(kimg_jxr PRIVATE ${LIBJXR_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(kimg_jxr PRIVATE jpegxr jxrglue)
|
||||||
|
target_compile_definitions(kimg_jxr PRIVATE INITGUID)
|
||||||
|
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=undef")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=undef")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
|
||||||
if (KF6Archive_FOUND)
|
if (KF6Archive_FOUND)
|
||||||
|
|
||||||
kimageformats_add_plugin(kimg_kra SOURCES kra.cpp)
|
kimageformats_add_plugin(kimg_kra SOURCES kra.cpp)
|
||||||
|