Compare commits
54 Commits
Author | SHA1 | Date | |
---|---|---|---|
ceb1c46fea | |||
6558b3255a | |||
374961dab4 | |||
b5d8b6638e | |||
92a1752c1f | |||
9f05ecb523 | |||
28c4ceeba9 | |||
f029a4a8ed | |||
56f229a2f1 | |||
72d4c41415 | |||
4923e2ecaa | |||
b645c9c258 | |||
8265b3602b | |||
dbd439bd98 | |||
a664baa9f9 | |||
c38a1a0248 | |||
2ea724c241 | |||
ecfbff8197 | |||
4dedd88c08 | |||
d233e80dbb | |||
799ac37660 | |||
0378bd67e1 | |||
7d696a81d2 | |||
b5d5abe0ea | |||
3f4690d1e9 | |||
ac1006cc66 | |||
97120b2537 | |||
fee0165bef | |||
ae641f7e94 | |||
46f7b90ce6 | |||
f7c8eaa140 | |||
36bfee8ae3 | |||
e2aaf89ec5 | |||
989a5c70d6 | |||
8588c053b6 | |||
145dedf360 | |||
2405a09e36 | |||
d02dcb064b | |||
0590c6b49d | |||
eb46f0f421 | |||
8c23e74ef6 | |||
219d9cb2c2 | |||
51921e8ee5 | |||
23e9fec869 | |||
4478bc8d2b | |||
acd6b3970c | |||
638fdfcbdd | |||
a497ab789b | |||
3590a43fc5 | |||
f5a6de7280 | |||
4c0f49295b | |||
e9da5edb9a | |||
e10f5aa9a5 | |||
14020a23d5 |
14
.gitattributes
vendored
@ -1 +1,15 @@
|
||||
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
|
||||
autotests/read/pfm/testcard_gray_half.phm binary
|
||||
autotests/read/pfm/testcard_rgb_half.phm binary
|
||||
|
@ -5,6 +5,7 @@ include:
|
||||
- project: sysadmin/ci-utilities
|
||||
file:
|
||||
- /gitlab-templates/linux-qt6.yml
|
||||
- /gitlab-templates/alpine-qt6.yml
|
||||
- /gitlab-templates/android-qt6.yml
|
||||
- /gitlab-templates/freebsd-qt6.yml
|
||||
- /gitlab-templates/windows-qt6.yml
|
||||
|
@ -7,3 +7,4 @@ Dependencies:
|
||||
Options:
|
||||
test-before-installing: True
|
||||
require-passing-tests-on: [ 'Linux', 'FreeBSD', 'Windows' ]
|
||||
cmake-options: "-DKIMAGEFORMATS_JXR=ON"
|
||||
|
@ -1,11 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(KF_VERSION "6.4.0") # handled by release scripts
|
||||
set(KF_DEP_VERSION "6.4.0") # handled by release scripts
|
||||
set(KF_VERSION "6.9.0") # handled by release scripts
|
||||
set(KF_DEP_VERSION "6.9.0") # handled by release scripts
|
||||
project(KImageFormats VERSION ${KF_VERSION})
|
||||
|
||||
include(FeatureSummary)
|
||||
find_package(ECM 6.4.0 NO_MODULE)
|
||||
find_package(ECM 6.9.0 NO_MODULE)
|
||||
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)
|
||||
|
||||
@ -21,7 +21,7 @@ include(ECMDeprecationSettings)
|
||||
include(CheckIncludeFiles)
|
||||
include(FindPkgConfig)
|
||||
|
||||
set(REQUIRED_QT_VERSION 6.5.0)
|
||||
set(REQUIRED_QT_VERSION 6.6.0)
|
||||
find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
||||
|
||||
find_package(KF6Archive ${KF_DEP_VERSION})
|
||||
@ -72,6 +72,7 @@ option(KIMAGEFORMATS_JXL "Enable plugin for JPEG XL format" ON)
|
||||
if(KIMAGEFORMATS_JXL)
|
||||
pkg_check_modules(LibJXL IMPORTED_TARGET libjxl>=0.7.0)
|
||||
pkg_check_modules(LibJXLThreads IMPORTED_TARGET libjxl_threads>=0.7.0)
|
||||
pkg_check_modules(LibJXLCMS IMPORTED_TARGET libjxl_cms>=0.9.0)
|
||||
endif()
|
||||
add_feature_info(LibJXL LibJXL_FOUND "required for the QImage plugin for JPEG XL images")
|
||||
|
||||
@ -88,8 +89,8 @@ endif()
|
||||
add_feature_info(LibJXR LibJXR_FOUND "required for the QImage plugin for JPEG XR images")
|
||||
|
||||
ecm_set_disabled_deprecation_versions(
|
||||
QT 6.5
|
||||
KF 5.102
|
||||
QT 6.8.0
|
||||
KF 6.8.0
|
||||
)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
169
README.md
@ -1,6 +1,6 @@
|
||||
# KImageFormats
|
||||
|
||||
Plugins to allow QImage to support extra file formats.
|
||||
Plugins to allow `QImage` to support extra file formats.
|
||||
|
||||
## Introduction
|
||||
|
||||
@ -19,18 +19,19 @@ The following image formats have read-only support:
|
||||
- Krita (kra)
|
||||
- OpenRaster (ora)
|
||||
- Pixar raster (pxr)
|
||||
- Portable FloatMap (pfm)
|
||||
- Portable FloatMap/HalfMap (pfm, phm)
|
||||
- Photoshop documents (psd, psb, pdd, psdt)
|
||||
- Radiance HDR (hdr)
|
||||
- Scitex CT (sct)
|
||||
- Sun Raster (im1, im8, im24, im32, ras, sun)
|
||||
|
||||
The following image formats have read and write support:
|
||||
|
||||
- AV1 Image File Format (avif)
|
||||
- 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 XR (jxr). Can be enabled with the KIMAGEFORMATS_JXR build option.
|
||||
- JPEG XR (jxr)
|
||||
- OpenEXR (exr)
|
||||
- Personal Computer Exchange (pcx)
|
||||
- Quite OK Image format (qoi)
|
||||
@ -40,7 +41,7 @@ The following image formats have read and write support:
|
||||
|
||||
## 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.
|
||||
|
||||
The main difference between this framework and the qimageformats module
|
||||
@ -68,3 +69,161 @@ 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).
|
||||
|
||||
## 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, JXL,
|
||||
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: 262,144 x 262,144 pixels, in any case no larger than 256 megapixels
|
||||
- JXR: n/a, in any case no larger than 4 GB
|
||||
- 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
|
||||
- SCT: 300,000 x 300,000 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, PSD and SCT 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 following defines can be defined in cmake to modify the behavior of the plugin:
|
||||
- `JXL_HDR_PRESERVATION_DISABLED`: disable floating point images (both read and write) by converting them to UINT16 images. Any HDR data is lost. Note that FP images are always disabled when compiling with libJXL less than v0.9.
|
||||
- `JXL_DECODE_BOXES_DISABLED`: disable reading of metadata (e.g. XMP).
|
||||
|
||||
### 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.
|
||||
|
@ -72,6 +72,7 @@ kimageformats_read_tests(
|
||||
qoi
|
||||
ras
|
||||
rgb
|
||||
sct
|
||||
tga
|
||||
)
|
||||
|
||||
|
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/jxl/chicken16.jxl
Normal file
BIN
autotests/read/jxl/chicken16.png
Normal file
After Width: | Height: | Size: 115 KiB |
BIN
autotests/read/jxl/chicken8.jxl
Normal file
BIN
autotests/read/jxl/chicken8.png
Normal file
After Width: | Height: | Size: 36 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/jxl/rgb_lossless_noprof.jxl
Normal file
BIN
autotests/read/jxl/rgb_lossless_noprof.png
Normal file
After Width: | Height: | Size: 829 KiB |
BIN
autotests/read/jxl/testcard_gray16.jxl
Normal file
BIN
autotests/read/jxl/testcard_gray16.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
autotests/read/jxl/testcard_gray8.jxl
Normal file
BIN
autotests/read/jxl/testcard_gray8.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
autotests/read/jxl/testcard_graya.jxl
Normal file
BIN
autotests/read/jxl/testcard_graya.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
autotests/read/jxl/testcard_rgb_fp16.jxl
Normal file
BIN
autotests/read/jxl/testcard_rgb_fp16.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
autotests/read/jxl/testcard_rgb_fp32.jxl
Normal file
BIN
autotests/read/jxl/testcard_rgb_fp32.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
autotests/read/jxl/testcard_rgba_fp16.jxl
Normal file
21
autotests/read/jxl/testcard_rgba_fp16.jxl.json
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.2.11",
|
||||
"maxQtVersion" : "6.2.99",
|
||||
"fileName" : "testcard_rgba_fp16.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.5.5",
|
||||
"maxQtVersion" : "6.5.99",
|
||||
"fileName" : "testcard_rgba_fp16.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.6.2",
|
||||
"fileName" : "testcard_rgba_fp16.png"
|
||||
},
|
||||
{
|
||||
"unsupportedFormat" : true,
|
||||
"comment" : "Skipped due to QTBUG-120614.",
|
||||
"seeAlso" : "https://bugreports.qt.io/browse/QTBUG-120614"
|
||||
}
|
||||
]
|
BIN
autotests/read/jxl/testcard_rgba_fp16.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
autotests/read/jxl/testcard_rgba_fp32.jxl
Normal file
21
autotests/read/jxl/testcard_rgba_fp32.jxl.json
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.2.11",
|
||||
"maxQtVersion" : "6.2.99",
|
||||
"fileName" : "testcard_rgba_fp32.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.5.5",
|
||||
"maxQtVersion" : "6.5.99",
|
||||
"fileName" : "testcard_rgba_fp32.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.6.2",
|
||||
"fileName" : "testcard_rgba_fp32.png"
|
||||
},
|
||||
{
|
||||
"unsupportedFormat" : true,
|
||||
"comment" : "Skipped due to QTBUG-120614.",
|
||||
"seeAlso" : "https://bugreports.qt.io/browse/QTBUG-120614"
|
||||
}
|
||||
]
|
BIN
autotests/read/jxl/testcard_rgba_fp32.png
Normal file
After Width: | Height: | Size: 16 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/CGA_FSD.pcx
Normal file
BIN
autotests/read/pcx/CGA_FSD.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
autotests/read/pcx/ICONDOC.pcx
Normal file
BIN
autotests/read/pcx/ICONDOC.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
autotests/read/pcx/dice_rgba.pcx
Normal file
BIN
autotests/read/pcx/dice_rgba.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
autotests/read/pcx/indexed4.pcx
Normal file
BIN
autotests/read/pcx/indexed4.png
Normal file
After Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/pfm/testcard_gray_half.phm
Normal file
BIN
autotests/read/pfm/testcard_gray_half.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/pfm/testcard_rgb_half.phm
Normal file
BIN
autotests/read/pfm/testcard_rgb_half.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
autotests/read/rgb/testcard_rgba.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
autotests/read/rgb/testcard_rgba.rgb
Normal file
BIN
autotests/read/sct/cmyk.sct
Normal file
11
autotests/read/sct/cmyk.sct.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.8.0",
|
||||
"fileName" : "cmyk.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/sct/cmyk.tif
Normal file
BIN
autotests/read/sct/gray.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
autotests/read/sct/gray.sct
Normal file
BIN
autotests/read/sct/rgb.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
autotests/read/sct/rgb.sct
Normal file
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 485 B |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 737 B |
@ -136,7 +136,7 @@ public:
|
||||
}
|
||||
if (reader->supportsOption(QImageIOHandler::ImageTransformation)) {
|
||||
m_transformations = reader->transformation();
|
||||
if (m_transformations < 0 || m_transformations > 7)
|
||||
if (int(m_transformations) < 0 || int(m_transformations) > 7)
|
||||
ok = false;
|
||||
}
|
||||
return ok;
|
||||
@ -177,7 +177,8 @@ public:
|
||||
{
|
||||
bool ok = true;
|
||||
if (!m_size.isEmpty()) {
|
||||
ok = ok && (m_size == image.size());
|
||||
// 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());
|
||||
@ -266,10 +267,13 @@ int main(int argc, char **argv)
|
||||
continue;
|
||||
}
|
||||
|
||||
bool skipTest = false;
|
||||
QFileInfo expFileInfo = timg.compareImage(skipTest);
|
||||
if (skipTest) {
|
||||
QTextStream(stdout) << "SKIP : " << fi.fileName() << ": image format not supported by current Qt version!\n";
|
||||
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;
|
||||
}
|
||||
@ -290,7 +294,7 @@ int main(int argc, char **argv)
|
||||
QImage expImage;
|
||||
|
||||
// inputImage is auto-rotated to final orientation
|
||||
inputReader.setAutoTransform(true);
|
||||
inputReader.setAutoTransform((flags & TemplateImage::DisableAutotransform) != TemplateImage::DisableAutotransform);
|
||||
|
||||
if (!expReader.read(&expImage)) {
|
||||
QTextStream(stdout) << "ERROR: " << fi.fileName() << ": could not load " << expfilename << ": " << expReader.errorString() << "\n";
|
||||
|
@ -28,10 +28,10 @@ bool TemplateImage::isTemplate() const
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo TemplateImage::compareImage(bool &skipTest) const
|
||||
QFileInfo TemplateImage::compareImage(TestFlags &flags, QString& comment) const
|
||||
{
|
||||
auto fi = jsonImage(skipTest);
|
||||
if (skipTest) {
|
||||
auto fi = jsonImage(flags, comment);
|
||||
if ((flags & TestFlag::SkipTest) == TestFlag::SkipTest) {
|
||||
return {};
|
||||
}
|
||||
if (fi.exists()) {
|
||||
@ -58,8 +58,9 @@ QFileInfo TemplateImage::legacyImage() const
|
||||
return {};
|
||||
}
|
||||
|
||||
QFileInfo TemplateImage::jsonImage(bool &skipTest) const
|
||||
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 {};
|
||||
@ -86,6 +87,10 @@ QFileInfo TemplateImage::jsonImage(bool &skipTest) const
|
||||
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)
|
||||
@ -95,7 +100,7 @@ QFileInfo TemplateImage::jsonImage(bool &skipTest) const
|
||||
if (!maxQt.isNull() && currentQt > maxQt)
|
||||
continue;
|
||||
if (unsupportedFormat) {
|
||||
skipTest = true;
|
||||
flags |= TestFlag::SkipTest;
|
||||
break;
|
||||
}
|
||||
return QFileInfo(QStringLiteral("%1/%2").arg(fi.path(), name));
|
||||
|
@ -16,6 +16,13 @@
|
||||
class TemplateImage
|
||||
{
|
||||
public:
|
||||
enum TestFlag {
|
||||
None = 0x0,
|
||||
SkipTest = 0x1,
|
||||
DisableAutotransform = 0x2
|
||||
};
|
||||
Q_DECLARE_FLAGS(TestFlags, TestFlag)
|
||||
|
||||
/*!
|
||||
* \brief TemplateImage
|
||||
* \param fi The image to test.
|
||||
@ -42,10 +49,10 @@ public:
|
||||
|
||||
/*!
|
||||
* \brief compareImage
|
||||
* \param skipTest True if the test should be skipped (e.g. image format not supported by current Qt version).
|
||||
* \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(bool &skipTest) const;
|
||||
QFileInfo compareImage(TestFlags &flags, QString& comment) const;
|
||||
|
||||
/*!
|
||||
* \brief suffixes
|
||||
@ -62,13 +69,15 @@ private:
|
||||
|
||||
/*!
|
||||
* \brief jsonImage
|
||||
* \param skipTest True if the test should be skipped (not supported).
|
||||
* \param flags Flags for modifying test behavior.
|
||||
* \return The template image read from the corresponding JSON.
|
||||
*/
|
||||
QFileInfo jsonImage(bool &skipTest) const;
|
||||
QFileInfo jsonImage(TestFlags &flags, QString& comment) const;
|
||||
|
||||
private:
|
||||
QFileInfo m_fi;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(TemplateImage::TestFlags)
|
||||
|
||||
#endif // TEMPLATEIMAGE_H
|
||||
|
Before Width: | Height: | Size: 743 B After Width: | Height: | Size: 743 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
BIN
autotests/write/basic/rgba.pcx
Normal file
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
BIN
autotests/write/format/_images/cmyk8.tif
Normal file
BIN
autotests/write/format/_images/gray16.png
Normal file
After Width: | Height: | Size: 2.6 KiB |