Compare commits

...

445 Commits

Author SHA1 Message Date
7420f47c17 Update dependency version to 6.15.0 2025-06-06 15:19:44 +02:00
888bca7387 cmake: add cmake config
That way, other projects can declare to have a runtime dependency on KImageFormats
2025-05-21 17:39:44 +02:00
e3aefd2aa1 JXR: Restore device position after reading options 2025-05-14 02:50:03 +02:00
aa8134ee0d README.md: minor fixes and improvements 2025-05-06 07:33:27 +02:00
9f09473aa0 It compiles fine without kf_6_13 deprecated methods 2025-05-04 21:31:49 +02:00
62eb1d28cb Add README about autotests 2025-05-03 11:01:46 +02:00
15bece40ec Update version to 6.15.0 2025-05-02 17:10:02 +02:00
1b3d2afbe3 Update dependency version to 6.14.0 2025-05-02 16:02:43 +02:00
850068c1dc JXR: fix compilation error on 32-bit systems 2025-04-22 08:01:02 +02:00
6bf38ea638 Improved EXIF V3 compatibility (2)
This patch improve the string read/write in case of non ASCII encoding.
- When reading, checks for UTF-8 text even on ASCII data type. If it fails, Latin1 converter is used.
- When writing using V3 specs, a better check is done to identify 7-bit ASCII text.

Related to MR !358
2025-04-21 11:29:13 +00:00
2adca7c0ca jxr: Use qsizetype for image size variables
Fixes type mismatch on 32-bit architectures.

/builddir/build/BUILD/kf6-kimageformats-6.13.0-build/kimageformats-6.13.0/src/imageformats/jxr.cpp: In member function ‘virtual bool JXRHandler::read(QImage*)’:
/builddir/build/BUILD/kf6-kimageformats-6.13.0-build/kimageformats-6.13.0/src/imageformats/jxr.cpp:994:88: error: no matching function for call to ‘min(qint64&, qsizetype)’
  994 |                 std::memcpy(img.scanLine(y), ba.data() + convStrideSize * y, (std::min)(convStrideSize, img.bytesPerLine()));
      |                                                                              ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-04-21 10:07:00 +02:00
dd69fdaea9 lib prefix on Android
Qt's original qtimageformats plug-ins use lib prefix too,
without the lib prefix, the image plug-ins don't work on Android.
2025-04-19 14:16:18 +00:00
ae62ea3dfc Improved EXIF V3 compatibility
EXIF specs V3 added the UTF-8 data type. The MicroExif class now allows serializations to choose whether to support the V2 or V3 format. To maximize compatibility with old readers, even when V3 is set, the ASCII data type is used if possible.

The JXR plugin, based on TIFF V6 container, does not allow to use the V3 format (it does not recognize the UTF-8 data type) and therefore V2 has been forced. For all other plugins using MicroExif, it is now possible to save, e.g., descriptions in Japanese.

Please note that this patch is also a bugfix: when saving, version 3 was set but the strings were always saved as ASCII.
2025-04-18 13:53:12 +00:00
9c47845f15 Update version to 6.14.0 2025-04-10 19:53:58 +02:00
7c7fa73020 Remove conditions for no longer supported Qt versions 2025-04-08 18:46:13 +02:00
92e4271e84 GIT_SILENT Upgrade Qt6 version requirement to 6.7.0. 2025-04-07 10:13:41 +02:00
6f588c6fd3 Add missing include mocs 2025-04-03 07:34:17 +02:00
a182478e2c It compiles fine without qt6.9 deprecated methods 2025-03-23 22:52:05 +00:00
4026f41890 PSD: use linear profile on float images
On float images, if not color profile is present, a linear one should be chosen. Photoshop works on 32-bit images in a linear color space.
2025-03-23 22:31:23 +00:00
bef2b9168f It compiles fine without kf6.12 deprecated methods 2025-03-22 06:47:20 +01:00
473f5d9847 Write tests for hej2 format 2025-03-16 21:31:46 +01:00
9bee29cc01 heif: enable saving of hej2 format 2025-03-16 18:37:48 +01:00
cdf3be3af1 Update dependency version to 6.13.0 2025-03-14 21:31:42 +01:00
752b18a42c CI: Enable heif so we make sure it compiles 2025-03-12 16:17:29 +00:00
97a1ea181c writetest: special handling for HEIF format 2025-03-12 16:41:39 +01:00
64a43fb04f readtest: special handling for HEIF format 2025-03-12 16:17:59 +01:00
6821c29819 heif: disable AVCI decoder for libheif before 1.19.6 2025-03-12 13:26:42 +01:00
e4d95c03fa SKIP tests when libheif configuration is incomplete 2025-03-10 22:01:14 +01:00
afa8ed1a5d heif: enable reading images with native 16 bit depth 2025-03-10 19:42:34 +01:00
245c835d92 Use of heif_context_add_XMP_metadata instead
heif_context_add_XMP_metadata2
2025-03-09 10:44:18 +01:00
b2663d2651 Update dependency version to 6.13.0 2025-03-07 19:00:23 +01:00
35ab37c628 Update dependency version to 6.12.0 2025-03-07 15:09:18 +01:00
b28baa4a1e sct: qRound with param bigger than max int is undefined
oss-fuzz/399667098
2025-03-04 06:33:52 +00:00
5d2540c135 sct: Use height instead of width when calculating dotsPerMeterY 2025-03-04 06:29:58 +00:00
25cc8bc262 MicroExif: search for the TIFF signature 2025-03-03 09:17:56 +01:00
7742537f8c MicroExif: API improvements and minor bugfixes 2025-03-02 13:34:02 +00:00
d3386bbf50 Fix compilation error 2025-03-02 13:49:25 +01:00
e77986c7e0 Added support for resolution and EXIF/XMP metadata to HEIF 2025-03-02 08:03:28 +00:00
c0261f4926 JXR: Added rotation (transformation) support
- Full rotation support on load and save.
- Improve also Windows compatibility by converting RGB32 to BGR32 on saving

Images saved with orientation are displayed correctly by Windows Explorer (which natively supports JXR files):

![_BC374A2E-7970-4B72-87BD-68DD3D8FB7AA_](/uploads/2268aa3066d82a4f97d026a64f2b70c2/_BC374A2E-7970-4B72-87BD-68DD3D8FB7AA_.png){width=597 height=259}
2025-02-25 21:37:17 +00:00
e5cf9caac5 JXR: added support to EXIF metadata
Improved metadata support via EXIF ​​metadata. Since JXR is based on a TIFF container, EXIF ​​data is read directly from the file so it always works (even with versions of libjxr that don't have the metadata reading API).

It also solves the following issues:
- Incorrect date format on saved JXR files (was saved in ISO format instead of `yyyy:MM:dd HH:mm:ss`).
- Incorrect date type setting in EXIF ​​data: the `DateTime` tag should be updated on every save (verified by GIMP and Photoshop). Our `CreationDate` metadata is the equivalent of the EXIF ​​`DateTimeOriginal` tag.

Closes #22
2025-02-23 00:38:27 +00:00
90d4256f3d AVIF: added support to XMP and EXIF metadata
Allow to load/save info about:
- GPS info (latitude, longitude, altitude)
- Various text info (title, description, author, copyright, etc...)
- Image resolution

The compatibility of the modifications has been tested with GIMP.
2025-02-19 11:56:19 +00:00
bb1c6aab9e Added pixel limit detected by experimental tests 2025-02-17 08:54:49 +01:00
74a734efed jxl: fix build with Qt before 6.8.0 2025-02-15 16:16:10 +01:00
e9fa4b6610 JP2: Disable ICC profile writing when saving an image with OpenJPEG V2.5.3 or lesser and improve the format detection on reading. 2025-02-12 06:45:21 +00:00
36a6ef7d78 heif: improve handling of grayscale ICC profiles 2025-02-10 16:59:49 +00:00
9fd6896cec Improve printing details when writetest fails 2025-02-10 16:59:49 +00:00
9b14e752db Update HEIF writetest templates 2025-02-10 16:59:49 +00:00
90a2e3b412 GIT_SILENT: it compiles fine without kf6.11 deprecated methods 2025-02-10 06:46:22 +01:00
b28cf4c352 Added JXL to CMYK formats 2025-02-07 15:55:23 +01:00
b536ec4a5e Update version to 6.12.0 2025-02-07 15:38:22 +01:00
7d7b295ac2 Update dependency version to 6.11.0 2025-02-07 14:47:25 +01:00
397957a976 jxl: refactor image saving, native CMYK support 2025-02-07 10:38:46 +00:00
18a729f7a1 Harmonized RAW mime types
Modifications based on information found online and the samples [here](https://raw.pixls.us/data).

Created a [MR for shared-mime-info](https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/341) with the missing mime types used in this MR.

Closes #19 

NOTE: for the following formats the images are not loaded by LibRAW (so I removed them): ari (ARRI), cap (Casio), lri (Light).
2025-02-07 10:38:26 +00:00
7a74b50d64 imageconverter: possibility to set image quality 2025-02-04 14:42:44 +01:00
0a06a07fa4 Print more details when writetest fails 2025-02-04 10:09:12 +00:00
e89408b426 Fix RAW mime type 2025-01-31 08:32:23 +01:00
8a05711e99 jxl: refactor image loading 2025-01-29 17:02:51 +00:00
d6534f0e68 Add xml/yaml linting 2025-01-29 06:57:55 +01:00
f608441b03 Fix jp2 and hdr plugin json definition
and add a check that the json files are well-formed

i.e. they have the same number of keys than of mimetypes
2025-01-24 14:48:09 +00:00
49060026b7 Read test: added perceptive fuzziness
Added a new parameter to the read tests called `perceptive-fuzz`.
The parameter, when active, modifies the fuzziness value based on the alpha value of the pixel. The more transparent the pixel, the more the fuzziness value increases.

We have found that some image manipulation functions give different results depending on the architecture (we think it is differences in rounding). These differences can become problematic with small alpha values ​​when there are several image conversions from normal alpha to premultiplied alpha (and vice versa).
In particular, the offending plugin is XCF.

The parameter should be set if and only if necessary. CMakeList has not been modified to allow it to be enabled on all format images (you can still try it from the command line). To use it, you need to set it in the JSON file of the image that has problems (after careful analysis).

More info about the issue on #18 

This MR also fixes a bug in `fazzeq()`: it only compared 1/4 of the image.

Below is the same XCF image rendered on AMD64 and PowerPC:

- AMD64:

![image](/uploads/7815ee49fac9b06d08bf1e0e3879f16e/image.png)

- PowerPC:

![image](/uploads/d7432902d638f6caf9589ebb4ad99827/image.png)

The image is visually the same because the differences are with very low alpha and therefore are negligible. The patch proposed with this MR is useful in these cases.
2025-01-24 13:07:32 +00:00
424e7a75de Modified PCX mime type according to IANA db 2025-01-23 08:00:37 +01:00
be534ea06e PSD: Alpha detection improvements
Small fix to improve alpha detection by checking also the Alpha Identifiers.
2025-01-20 22:30:23 +00:00
baaf1093a1 GIT_SILENT: it compiles fine without kf6.10 deprecated methods 2025-01-20 09:53:06 +00:00
e83458a5d8 PSD: improved option support
Added support for the following options:
- `ImageTransformation`: uses EXIF data (same behaviour of Photoshop and GIMP)
- `Description`: uses EXIF data
- `ImageFormat` 

Closes #17
2025-01-18 22:32:15 +00:00
873ec1bb5f More metadata read tests
Adds some metadata/read resolution tests without adding new images.
2025-01-16 23:03:37 +00:00
287a447095 Fix use of deprecated methods 2025-01-16 14:02:44 +01:00
ebb9c1ec18 Metadata and image resolution write test
The goal of MR is to control the correct saving of metadata and resolution in plugins that support them.

- Modified the basic write test to verify that resolution and metadata are saved correctly.
- Verifies the correct functioning of MicroExif in plugins that use it to save metadata.
- EXR: fixed wrong vertical resolution (error found with this MR).
- Added EXR, JXR, JXL, PCX metadata test.
2025-01-16 07:14:27 +00:00
ac3591c7ea PSD: added support to EXIF metadata 2025-01-15 23:26:02 +00:00
a89367dde6 JXR: set max XMP size to 4MiB 2025-01-15 20:36:28 +00:00
65a587afad CI: Add linux-qt6-next build 2025-01-15 19:16:26 +01:00
5f92bcbf26 DDS: Fix warning in qfloat16 and test failure on PowerPC
Fixes the following warning:
```
/home/daniel/kimageformats/src/imageformats/dds.cpp: In function ‘qfloat16 readFloat16(QDataStream&)’:
/home/daniel/kimageformats/src/imageformats/dds.cpp:1037:11: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class qfloat16’ from an array of ‘quint16’ {aka ‘short unsigned int’} [-Wclass-memaccess]
 1037 |     memcpy(&f16, &rawData, sizeof(rawData));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/qt6/QtCore/qmetatype.h:14,
                 from /usr/include/qt6/QtCore/qobject.h:18,
                 from /usr/include/qt6/QtCore/qiodevice.h:10,
                 from /usr/include/qt6/QtGui/qimageiohandler.h:9,
                 from /usr/include/qt6/QtGui/QImageIOPlugin:1,
                 from /home/daniel/kimageformats/src/imageformats/dds_p.h:13,
                 from /home/daniel/kimageformats/src/imageformats/dds.cpp:12:
/usr/include/qt6/QtCore/qfloat16.h:46:7: note: ‘class qfloat16’ declared here
   46 | class qfloat16
      |       ^~~~~~~~

```

Should also fixes the following failed tests under PowerPC (32-bits):
```
INFO : rgba16dx10.dds: converting rgba16dx10.dds from RGBA16FPx4 to ARGB32
FAIL : rgba16dx10.dds: differs from rgba16dx10.png
       expected data written to rgba16dx10.dds-expected.data
       actual data written to rgba16dx10.dds-actual.data
```
```
INFO : rgba_f16.dds: converting rgba_f16.dds from RGBA16FPx4 to ARGB32
FAIL : rgba_f16.dds: differs from rgba_f16.png
       expected data written to rgba_f16.dds-expected.data
       actual data written to rgba_f16.dds-actual.data
```
2025-01-15 17:45:57 +00:00
ae00c110f2 JXL: Resolution and metadata support via EXIF
- Added a class to read and write minimal exif metadata.
- JXL plugin uses EXIF metadata to load/save the resolution of the image (like GIMP).
- JXL plugin uses EXIF metadata to set/store text metadata and date/time.
- Enable info display in Dolphin (JXL File -> Properties -> Details on a JXL file, see image below).
- Enabled read test to check also image metadata and resolution.

![_52C044E4-1BA9-4D84-AC0A-B834CDAF72D8_](/uploads/f1649c2b506bf61a5f5488da0d4a4534/_52C044E4-1BA9-4D84-AC0A-B834CDAF72D8_.png){width=401 height=357}
2025-01-15 06:12:07 +00:00
f39ca9dc9b ani: Read chunk elements one at a time instead all at once
This way if the file is malformed and there's not that many elements we don't
try allocate too much memory to read into

BUGS: 498368
2025-01-14 00:40:26 +01:00
f296c38daf xcf: Return early if seek fails
BUGS: 498381
2025-01-09 02:33:51 +00:00
bda8487147 heif: fix -Wstringop-overread warning 2025-01-08 16:45:57 +01:00
bb10c4bd5c jxl: refactor metadata boxes reading 2025-01-08 12:43:42 +01:00
1982557a55 RAW: Allow preview loading
This patch addresses reports of performance issues on large raw collections. Programs that generate previews must use the plugin correctly.

**Setting quality to 0 may return a different image than in the past** (Nothing changes for all other quality values): the plugin loads the embedded thumbnail and, in case of error, decodes the image with quality 1. When compiled with libRAW 0.21+, the plugin automatically select the largest preview from the ones in the file.
2025-01-08 07:01:57 +00:00
c97ee00f5e Add JPEG 2000 support
JPEG 2000 support using OpenJPEG library.

- Add read/write support to JP2/J2K format for Gray/RGB(A)/CMYK images @8/16-bits
- Read test case images generated by Photoshop

The plugin has the following limitations:
- Resolution is not set (JP2_RES box is marked "For the future" in jp2.h)
- Metadata are not set (as with resolution)

Closes #13
2025-01-05 10:36:21 +00:00
e6a0f8758b JXL: Fix missing checks for BOXES when parsing animation
Fix error when parsing something like:

```
JXL_DEC_BOX
JXL_DEC_BOX
JXL_DEC_BOX
JXL_DEC_BASIC_INFO
JXL_DEC_COLOR_ENCODING
JXL_DEC_BOX
JXL_DEC_BOX
JXL_DEC_FRAME
JXL_DEC_BOX
JXL_DEC_FRAME
```

CCBUG: 496350
2025-01-04 06:46:41 +00:00
5c0c7e4fd7 Try writers with different image sizes
Improve the write test by using images with different sizes. By doing this we protect ourselves from line alignment problems (e.g. with 1-bpp images), image size divisors (e.g. power-of-2 divisors), etc...

Pros:
- The test does not add new images but reuses the ones for the format test.

Cons:
- No test are done for read only plugins.

Closes #15
2025-01-03 23:32:06 +00:00
40c2aae0cd Update version to 6.11.0 2025-01-03 16:41:05 +01:00
f49704b2df Update dependency version to 6.10.0 2025-01-03 16:15:48 +01:00
43f3fd05f7 avif: color profiles improvements
With Qt 6.8.x, PQ and HLG transfer functions are supported.
Better support for GRAY profiles
2025-01-02 14:11:55 +01:00
a7cf1a87f9 Update heif.json 2024-12-31 17:33:58 +01:00
fe28130cb3 HEIF plug-in extended to read AVCI format
AVCI is H.264 encapsulated in HEIF container
2024-12-29 23:44:18 +01:00
c0d5b8854b Readme updated with some clarification
- `Contributing` section: `qimageformats module of Qt` changed to `image formats of Qt` because the Qt plugins are also in the core module (e.g. PNG)
- `The HEIF plugin` section: clarified which codec is needed for testing (HEVC)
- Added missing info about EPS, KRA and ORA
- Other minor changes
2024-12-29 07:37:06 +00:00
0b2c6d725d DDS: enable plugin by default
- Enabled the plugin as OSS Fuzz did not find anything yet
- Modified README by adding more info about contributing, DDS plugin and some clarifications

Solves CCBUG: 380956 CCBUG: 389900
2024-12-24 08:59:32 +00:00
894524f7e4 PSD: Added support to MCH1 and MCH2
- Multichannel images are treat as CMYK image when the number of channels are more than 1: when exists, channel 5 is used as alpha. Channels higher than 5 are discarded.
- Multichannel images are treat as Grayscaleimage when the number of channels are equals to 1.
- Device transactions removed (where possible)
- Fix clang-format issues
2024-12-23 23:58:40 +00:00
348ddce987 XCF: Fix OSS Fuzz issue 42527849
Fixes integer overflow when the value is -INT_MAX-1
2024-12-23 22:05:05 +00:00
1cb294545f JXR: Fix loss of HDR data on write for format RGBA16FPx16_Premultiplied
When writing RGBA16FPx16_Premultiplied format, the image was converted to RGBA64 by clamping the float values. With this patch float values ​​outside the range [0, 1] are preserved.
2024-12-23 06:36:39 +00:00
b649cca304 DDS: Fix for OSS Fuzz issue 384974505 2024-12-19 07:18:37 +00:00
adc5c7ae9a DDS: improved read/write support
The following changes have been made:

- Improved writing speed by using scanLine() instead of pixel()
- Optimized memory usage on writing by using ScanlineConverter class
- Added native write support for RGBA32FPx4, RGBA16FPx4, RGB8, Grayscale8 and Indexed8 uncompressed formats
- Grayscale DDS without alpha are loaded in a Grayscale8 image
- Fixed warnings about wrong PITCH reported by GIMP on DDSs saved by this plugin
- Initial support for loading DX10 formats (R16F, RG16F, RGBA16F, RGBPreMulA16F, R32F, RG32F, RGBA32F, RGBPreMulA32F)
- Fixed alignment issues and A8P8 format support of the attached images*

Tested using GIMP and [NVIDIA Texture Tools](https://developer.nvidia.com/texture-tools-exporter) plugin for Photoshop.

(*) The following images (taken from [here](https://github.com/walbourn/directxtexmedia)) cannot be added to read tests due to license issue:
[test8_DWORD.dds](/uploads/449b5a0d886aaf6764af554fe38e2b09/test8_DWORD.dds)
[dx5_logo.dds](/uploads/6f5f27df752890b227ef07e0195435d4/dx5_logo.dds)
[test888_DWORD.dds](/uploads/c8bc355c5749cf203d47e0b3073ad419/test888_DWORD.dds)
2024-12-17 23:08:43 +00:00
a6f7482957 Read / Write test: added NULL device test
DDS plugin crashes if I request supportedSubTypes()

- Fixed DDS plugin crash
- Added NULL device test on both read and write tests

Closes #14
2024-12-16 13:52:06 +00:00
d91c7dd912 DDS: multiple FP improvements
- Use of native qfloat16 format
- FP16 and FP32 HDR images are preserved and sRGB Linear profile is set
- Images are always saved as 8-bit so, if valid profile is present the image is converted to sRGB 
- It also fixes (left image) a problem (right image) with HDR images:
![_DF316651-18AF-498F-8689-B3613F8C9D45_](/uploads/f5deb9bff6d22dae94ecf7942d8fd806/_DF316651-18AF-498F-8689-B3613F8C9D45_.png){width=281 height=157}![_AF65379D-E6A5-4007-863D-7B60EDFB7383_](/uploads/92460f2dabbb763061f6e6143bc36719/_AF65379D-E6A5-4007-863D-7B60EDFB7383_.png){width=271 height=169}
2024-12-12 22:07:07 +00:00
86865223d2 PFM: fix error when loading images with comments
I tested the plugin with the images stored [here](https://github.com/walbourn/directxtexmedia). It contains PFM and PHM images but I didn't find any license on the repo, so the images was not added to test cases.

I attach here the images that this patch allows to load:
[grad4d_mono.pfm](/uploads/6e41fcb64d0651a6abd78cffc5ff86b2/grad4d_mono.pfm)
[grad4d_mono.phm](/uploads/348a51476068aa344f67826006cb65c4/grad4d_mono.phm)
[grad4d.phm](/uploads/2ab8330466f4dd0fc2fda00711270ce9/grad4d.phm)
2024-12-12 09:48:34 +00:00
ecbcf3b7f4 DDS: fix buffer overflow in readCubeMap
The issue was identified by OSS Fuzz and the feature was not covered by our tests.

- Added earth-cubemap.dds under MIT licenses taken from [Open Toolkit library](https://github.com/mono/opentk/tree/main/Source/Examples/Data/Textures)
- Fix a wrong image size returned by a cubemap image
- Read test skips .license files
2024-12-12 09:42:24 +00:00
87eff569a4 Re-added DDS plugin support
Fork of [Qt 5.6 DDS plugin](https://code.qt.io/cgit/qt/qtimageformats.git/tree/src/plugins/imageformats/dds/qddshandler.cpp?h=5.6) under LGPL2.1.

- Merged all files in dds_p.h and dds.cpp
- Added support for Qt 6 image allocation limit
- Added checks for null image and datastream errors
- The plugin is disabled by default

CCBUG: 380956

Closes: #12
2024-12-11 06:45:00 +00:00
a531978e2a Update version to 6.10.0 2024-12-06 16:07:49 +01:00
ceb1c46fea Update dependency version to 6.9.0 2024-12-06 12:41:46 +01:00
6558b3255a jxl: Disable color conversion for animations
Workaround for issue https://github.com/libjxl/libjxl/issues/3983
libjxl_cms is used for color conversion of lossy static images.
Fix loading of lossy grayscale images
Fix loading of grayscale images with odd width
2024-11-30 23:18:06 +01:00
374961dab4 Improve CMYK writing support
Closes #11 

Requires MR !279

On formats that does not support CMYK and does not use the ScanLineConverter class during write operation, the CMYK images must be converted using the color space conversion functions of `QImage` (if ICC profile is valid).
2024-11-28 06:57:01 +00:00
b5d8b6638e Improved write test
Closes #10 

Added image format test: I pass every image format supported by QImage (except Alpha8) to the plugin and check the result.
2024-11-28 06:52:15 +00:00
92a1752c1f JXL: load error with some lossless file
When loading lossless JXL images without ICC profile, the parser failed.
The problem was caused by Boxes being enabled (MR !250). The parser should probably be revised to be more flexible.

CCBUG: 496350
2024-11-20 16:34:00 +00:00
9f05ecb523 JXR: jxrlib cannot write HDP and WDP formats
According with JXRLib GetIIDInfo(), HDP and WPD formats are read only.
```
    static PKIIDInfo iidInfo[] = {
        {".jxr", &IID_PKImageWmpEncode, &IID_PKImageWmpDecode},
        {".wdp", &IID_PKImageUnsupported, &IID_PKImageWmpDecode},
        {".hdp", &IID_PKImageUnsupported, &IID_PKImageWmpDecode},
    };
```
2024-11-19 13:52:15 +00:00
28c4ceeba9 heif: avoid crash in heif_image_handle_has_alpha_channel
Try to load Xiaomi images with non-strict decoding second time.
2024-11-17 15:17:13 +01:00
f029a4a8ed Bump KF and QT versions in ecm_set_disabled_deprecation_versions 2024-11-17 10:52:09 +01:00
56f229a2f1 GIT_SILENT Upgrade Qt6 version requirement to 6.6.0. 2024-11-13 21:41:34 +01:00
72d4c41415 ci: add Alpine/musl job 2024-11-12 15:53:28 +01:00
4923e2ecaa RGB: avoid to read wrong data
Should fixes OSS Fuzz issue 42538251
2024-11-11 23:06:49 +00:00
b645c9c258 JXL: Fix OSS Fuzz issue 377971416 2024-11-09 10:44:04 +00:00
8265b3602b Fix compilation warnings
Fixed warnings reported by CIs in our code.
2024-11-07 22:10:11 +00:00
dbd439bd98 JXR: Fix libraries link under FreeBSD
JXR libraries are finally inside FreeBSD CI machines. In fact he stopped building.
2024-11-07 06:55:28 +00:00
a664baa9f9 JXL: fixed bug when saving grayscale images without color profile
Saving grayscale images at less than 100% quality made the file unreadable.
Fix also a regression while loading GrayA images introduced with MR !250
2024-11-06 21:15:04 +00:00
c38a1a0248 PFM: extended to half float format
The Portable HalfMap is a format supported by ImageMagick. The test cases was generated by converting pfm to phm using ImageMagick: `convert image.pfm image.phm`.
2024-11-06 21:12:05 +00:00
2ea724c241 Rename SCT plugin for OSS-FUZZ
To make OSS fuzz build script happy, the test folder and the cpp file must have the same name.
2024-11-05 12:17:52 +00:00
ecfbff8197 PCX: support for more formats
Added support for:
- (R/O) 1 bit, 3 planes (ICONDOC.pcx) -> test case from internet archive
- (R/O) 2 bits, 1 planes (CGA_FSD.pcx) -> test case from internet archive
- (R/W) 8 bits, 4 planes (dice_rgba.pcx) -> supported by ImageMagick and GIMP 3

Fix write support for:
- Grayscale 8/16-bits (saved as indexed)
- Alpha 8 (saved as indexed)
- RGB 16-bits depth (saved as RGB 24/32)
2024-11-05 06:36:18 +00:00
4dedd88c08 SCT: added read only support
I keep adding old formats to ensure interoperability with as many programs as possible...

This plugin adds read-only support for the Scitex SCT format only. This format is also supported by Photoshop in read and write (SCT test cases were created by Photoshop).

[Scitex HandShake Formats Specifications](/uploads/a3e213e48349d898b260375d6c052521/Scitex_HandShake_Formats.pdf)
2024-11-04 13:05:59 +00:00
d233e80dbb Update version to 6.9.0 2024-11-02 17:04:01 +01:00
799ac37660 Update dependency version to 6.8.0 2024-11-02 16:13:04 +01:00
0378bd67e1 TGA: Fixed GrayA image loading error
Gray TGA images with alpha were loading incorrectly and tests did not detect the error since the BW(A).TGA images were actually RGB(A) images.
2024-10-24 15:07:44 +00:00
7d696a81d2 exr: Fix read/write with openexr 3.3
It really wants to have a filename

Also it uses seek and tell a lot so sequential devices are for now not
supported

BUGS: 494571
2024-10-12 01:47:22 +02:00
b5d5abe0ea JXL improvements
Highlights of the patch:
- Supersede MR !249
- Added FP16 and FP32 images support thus preserving HDR values (read / write, required libjxl 0.9+).
- Added Gray8 and Gray16 support (read / write).
- Indexed images are saved as Gray8 when palette is gray scale.
- Binary images are saved as Gray8 (does JXL natively support binary images?).
- Simplified writing process by partially removing the use of additional buffers.
- Added XMP metadata support by decoding/encoding Boxes.
- Changed maximum image size in pixels in accordance with JXL feature level 5 (still limited to 256 megapixels).

Compatibility: 
- Older versions of this plugin load FP images correctly as UINT16 (obviously losing HDR info).
- HDR images saved with this patch are also loaded correctly by Gimp and Photoshop.
- Grayscale images saved with this patch are also loaded correctly by Gimp and Photoshop.

Compilation modifiers for cmake file:
- `JXL_HDR_PRESERVATION_DISABLED`: disable the FP support (behaves like previous versions).
- `JXL_DECODE_BOXES_DISABLED`: disable metadata reading (behaves like previous versions).
2024-10-11 12:42:42 +00:00
3f4690d1e9 Update version to 6.8.0 2024-10-11 13:35:32 +02:00
ac1006cc66 JXR: Fixed image reading on sequential devices
The following changes are done:
- Fixed an error when copying image from sequential device
- Return error when the image exceed 4GB size on writing*
- Enabled JXR tests

(*) Note that when writing an image larger than 4GiB, the JXRLib does not give any error but the resulting saved image id wrong.
2024-10-09 21:34:32 +00:00
97120b2537 Simplified read/verify header process
Where possible, QIODevice::peek has been used instead of transactions or instead of using ungetchar() for sequential access devices and seek() for random access devices.

Furthermore:
- RAS format gained the ability of read on sequential devices.
- Removed unused code in XCF (still related to ungetchar and sequential devices).
- These changes should prevent errors like the ones fixed by MR !258
2024-10-06 17:26:25 +00:00
fee0165bef Update dependency version to 6.7.0 2024-10-04 16:57:57 +02:00
ae641f7e94 Fix endianness bug in PCX reader on big endian architectures
When reading from a sequential device, the peekHeader() method in
the PCX readers reads the header its defined little endian into
arch-specific endianness for multibyte types.

Being a "peek" method, it then it tries to push back the bytes into
the device after reading for its next use, but it doesn’t convert
multibyte types correctly from arch-specifice endianness to the
initial little endian format.

Subsequent reading of the data from the device will thus lead to
incorrect values for multibyte types on the next use.

This patch reuses the same technique as the TGA reader to read the
whole header as bytes before deserializing it, so that the bytes
can be pushed back into the sequential device in the same order.
2024-09-22 01:31:13 +02:00
46f7b90ce6 Fixed read of BGR32 and RGB555 formats 2024-09-16 17:16:28 +02:00
f7c8eaa140 FIxed comparison of unsigned expression
Fix of [Issue 9](https://invent.kde.org/frameworks/kimageformats/-/issues/9)

Same of MR !253 to solve the `Fix of [Issue 9](https://invent.kde.org/frameworks/kimageformats/-/issues/9)` when rebasing.
2024-09-15 15:00:11 +00:00
36bfee8ae3 raw: Getting the image size does not need unpacking
According to the libraw documentation, the sizes are available directly
after open_datastream.
2024-09-13 19:17:31 +02:00
e2aaf89ec5 Update version to 6.7.0 2024-09-06 14:21:04 +02:00
989a5c70d6 Update version to 6.6.0 2024-09-06 13:28:36 +02:00
8588c053b6 XCF: fix crash 2024-08-27 21:52:16 +00:00
145dedf360 README update
Added some information about plugins and their behaviors (when they do particular things).
2024-08-26 15:18:57 +00:00
2405a09e36 RGB: added options support
- Added support for `Size` and `Format` options and slightly improved format detection from canRead().
- Removed conversion to ARGB32 on load (improved performace with RGBA images).
- Added result checks on writing.

With this MR, all plugins have minimal support for options.
2024-08-25 21:00:08 +00:00
d02dcb064b PCX: added options support
- Added support for ```Size``` and ```Format``` options and slightly improved format detection from canRead().
- Added PCXHEADER::isValid() method to consolidate header consistency checks in one place.
2024-08-17 06:40:29 +00:00
0590c6b49d Update version to 6.6.0 2024-08-09 12:58:58 +02:00
eb46f0f421 Fix crash on malformed files
Co-authored-by: Mirco Miranda <mircomir@gmail.com>
2024-08-05 22:15:06 +00:00
8c23e74ef6 Update dependency version to 6.5.0 2024-08-02 12:56:31 +02:00
219d9cb2c2 JXL: added ImageTransformation option
Let Qt rotate the image when the ImageAutotransform option is set to true.

In tests it also solves the image size control with the value returned by the options with certain rotations.
2024-07-30 22:46:52 +00:00
51921e8ee5 xcf: Fix crash on malformed files 2024-07-29 20:53:13 +02:00
23e9fec869 pcx: Fix crash in broken files 2024-07-26 16:53:32 +02:00
4478bc8d2b xcf: Fix crash on broken files 2024-07-25 00:04:38 +02:00
acd6b3970c pcx: fix crash on invalid files 2024-07-23 00:22:08 +02:00
638fdfcbdd pcx: fix crash on invalid files
Added new PCX testfile for readtest.
2024-07-22 22:13:14 +00:00
a497ab789b exr: added some usefull attributes 2024-07-21 04:52:18 +00:00
3590a43fc5 pcx: Read 16 color images that are 4bpp and 1 plane
We had code for 1bpp and 4 planes but gimp is generating this format
2024-07-19 21:30:59 +00:00
f5a6de7280 Full range HDR support
EXR, HDR, JXR and PFM formats support High Dynamic Range images (FP values grater than 1).

In summary, here is the list of changes:

    EXR, HDR, JXR and PFM: When working with FP formats, the clamp between 0 and 1 ​​is no longer done.
    EXR: Removed old SDR code and conversions. Due to the lack of a QImage Gray FP format, Gray images are output as RGB FP (recently added code for Qt 6.8 has been removed).
    PFM: Due to the lack of a QImage Gray FP format, Gray images are output as RGB FP.
    HDR: Added rotation and exposure support.

With this patch, EXR, JXR, HDR, PFM behave like Qt's TIFF plugin when working with FP images.
2024-07-17 22:24:57 +02:00
4c0f49295b Prepare gitlab for files that are coming int the next commit 2024-07-17 22:24:33 +02:00
e9da5edb9a avif: check return values
Some libavif calls did not return values in the older versions.
Situation changed meanwhile;
we can check the return values for error conditions now.
2024-07-15 17:46:21 +02:00
e10f5aa9a5 raw: Fix compiler warning with macro redefinition in Windows
This fixes the following compiler warning with mingw-w64 toolchain in Windows.

raw.cpp:436:9: warning: "DEFAULT_QUALITY" redefined
  436 | #define DEFAULT_QUALITY (C_IQ(3) | C_OC(1) | C_CW(1) | C_AW(1) | C_BT(1) | C_HS(0) | C_FLAGS(1))
      |         ^~~~~~~~~~~~~~~
wingdi.h:1142:9: note: this is the location of the previous definition
 1142 | #define DEFAULT_QUALITY 0
      |         ^~~~~~~~~~~~~~~

DEFAULT_QUALITY macro is used with CreateFontW API.
https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createfontw
2024-07-14 04:14:18 +00:00
14020a23d5 Update version to 6.5.0 2024-07-12 13:27:10 +02:00
bb17f7bf84 update version for new release 2024-07-05 13:19:28 +02:00
b849e48ef4 Fixed wrong plugin options behaviour
While working on MR !230 I noticed that the options read I entered into several plugins could not be read after reading the image.

**The patch fixes problems reading options in plugins and adds option checking in the readtest.cpp.**

In particular, the reading test does the following additional actions:
- reads options before reading the image;
- compare the options read with the options returned by the reader after reading the image;
- compares the format and size of the returned image with the format and size returned by the reader.
2024-06-19 22:18:45 +00:00
81b7263d73 EXR: Full support for gray image/colorspace
Starting with Qt 6.8, QColorSpace supports Gray and CMYK color profiles.

- On saving, grayscale images are converted to linear gray profile;
- On loading, a Grayscale image is stored in a QImage::Format_Grayscale16 instead a RGB one;
- ScanlineConverter class was updated to gray conversions.
2024-06-17 15:17:51 +00:00
63e21ee5f3 Disable JXR plugin due to crashes in JXRLIB
I ran a simple fuzzer on all the plugins in the repo and the JXR one crashes every few seconds. I attach some files (I have many more) that cause the crashes. For the moment I think it's best to keep it deactivated.

The strange thing is that for the same plugin I had created the PR on oss-fuzz which ran locally for over an hour without problems. I'm a bit confused.
2024-06-13 22:24:19 +00:00
06f097046c PFM: Portable FloatMap read only support
Simple HDR format supported by GIMP (read/write) and Photoshop (read/write).
2024-06-13 22:20:40 +00:00
950ed43623 PXR: Pixar raster read only support
Limited read only support to Pixar raster as supported by Photoshop (RGB and Gray 8-bit only).
2024-06-12 22:42:08 +00:00
863c424390 Sanity checks (fuzzer)
I ran a stupid fuzzer on all the plugins in the repo and some plugins needs more sanity checks.

- RAS: fixed palette reading on corrupted files
- RGB: improved error detection on datastream

This patch improves the reading speed of some corrupted files and limit the maximum memory allocation of RAS palette.
2024-06-11 22:15:27 +00:00
bd083ff354 XCF: fixed wrong composite on Grayscale images
CCBUG: 476755
2024-06-10 20:16:31 +00:00
99663607b2 Fix compilation 2024-06-07 15:08:53 +00:00
7499e3b8d4 Use of metadata macro definitions
Replaced the metadata string with the common macro definition
2024-06-07 15:08:37 +00:00
cb5ca7fc48 JXR: added CMYK image to read test
Improved read test to skip unsupported image format: the CMYK image test only works if you compile with Qt 6.8 or higher.
2024-06-07 14:09:34 +00:00
4f61e3912c XCF: Increased maximum property size
CCBUG: 426222

The problem was caused by a check on the maximum size of properties (specifically it failed on PROP_PARASITES).
2024-06-07 11:43:31 +00:00
b8a9c75c80 JXR support
CCBUG: 451584

An implementation of the JXR format.
2024-06-07 10:35:25 +00:00
4995c9cd15 PSD: support native CMYK introduced by Qt 6.8
Qt 6.8 will introduce native support for the CMYK (8-bit) format.
With this patch you will finally be able to correctly see the colors of CMYK images with ICC profile.
The testing part has been updated with the addition of an (optional) json file for each image to test. Inside you enter which image to use depending on the Qt version.

In short:
- Added native CMYK suport to PSD reader
- CMYK with alpha is converted using QColorSpace in a RGBA image
- Read tests changed to use the correct comparison image based on the Qt version
- Fixed also XCF tests: now works with all Qt version (see also [QTBUG-120614](https://bugreports.qt.io/browse/QTBUG-120614))
- Work around for CCBUG: 468288
2024-06-07 10:16:58 +00:00
a54c5e876c update version for new release 2024-05-31 17:41:40 +02:00
6c1a7ad339 update version for new release 2024-05-31 15:15:35 +02:00
c721fa481b Remove explicit maintainer from metainfo
All frameworks are maintained by the KDE community
2024-05-12 21:27:40 +02:00
ea15fed399 update version for new release 2024-05-12 14:06:57 +02:00
c2fabef501 Ensure dependencies are provided on Android 2024-05-06 00:02:54 +12:00
5b2c190823 update version for new release 2024-05-03 11:49:56 +02:00
1b94554323 update version for new release 2024-04-12 16:12:29 +01:00
c2c12b1d7e Fix build with Qt 6.7 on 32 bits
Qt changed the argument type again in 0ed34d1992
2024-04-11 08:30:45 +02:00
c169296fbf update version for new release 2024-04-05 11:45:58 +01:00
29aec82e67 Add KF_VERSION & KF_DEP_VERSION variables
For consistency with the other KF modules, but also to have some version
info with working copies/checkouts, as well as min required KF deps.
2024-03-18 16:24:41 +01:00
95ee381195 XCF: testcase update for fixed Qt
Updated testcases to work with Qt without alpha [bug](https://bugreports.qt.io/browse/QTBUG-120614.).

Needs Qt >= 6.6.2 for tests to pass
2024-03-14 21:49:09 +00:00
8e5951471d TGA: added options support
- Added Size and Format options support
- Fixed a double image allocation when reading RGBA images (RGB was always allocated and then replaced by RGBA one)
- Fixed the code for sequential devices

The Size option is used by the KIO 5 thumbnailer to avoid to use too memory. A backport to KF5 would serve CCBUG: 413801 and CCBUG: 479612
2024-03-04 23:47:59 +00:00
0710bc65f6 More header checks (CCBUG: 479612) 2024-02-29 15:55:57 +01:00
4be09ba419 update version for new release 2024-02-21 11:15:16 +00:00
6cbdf9cf54 Workaround QTBUG-120614 2024-02-09 07:55:28 +00:00
7d6de20e8c update version for new release 2024-02-01 09:26:20 +00:00
b37c991e39 Port to ECMFeatureSummary
This avoids a feature summary in the middle of the cmake configuration
when this module is used as a git submodule.

GIT_SILENT
2024-01-26 14:17:50 +01:00
249046f25d update version for new release 2024-01-10 11:27:02 +00:00
9f7b1b8dee ScanlineConverter: fix indexed conversion and support for source depth less than 24 bits 2024-01-06 09:04:06 +01:00
f065104b72 Less space used when saving a grayscale image 2024-01-06 08:20:14 +01:00
f34185197a Fix build with Qt 6.7 2023-12-20 18:32:28 +01:00
9f24023ca7 The maximum number of channels explained better
Just a clarification on why the maximum value of channels present in the specifications is not used.
2023-12-20 16:43:12 +00:00
8d1ef536be Code is qt6 only now. Remove unused check 2023-12-16 11:16:53 +00:00
da8ed31aec avif: new quality settings
Prior libavif 1.0, quality was set using two numbers
(minQuantizer and maxQuantizer).
New versions of libavif recommend using
new/single quality parameter instead.
Compression using the new settings is different
compared to the old.
For example, new quality 68 gives similar compression
like old default 52.
2023-12-13 17:40:21 +01:00
ce8383e5fd HEIF plug-in extended to support HEJ2 format
HEJ2 is JPEG 2000 codec encapsulated in HEIF container.
Only HEJ2 reading is implemented.
2023-12-07 13:26:43 +01:00
db0adee62f GIT_SILENT: Port to new CI template 2023-11-20 07:14:46 +01:00
91a342e90d Cleanup pre-Qt 6.5 code 2023-11-19 14:14:36 +01:00
7864ad4bc6 There's no QVector anymore, QList is the QVector in Qt6 2023-10-20 07:10:28 +02:00
524711f633 Add missing license texts
BUG: 475299
2023-10-07 00:00:52 +02:00
b8b980f400 avif: support repetition count
and minor performance optimizations.
2023-10-06 13:03:28 +02:00
d932e0d16b Multi-image, same behavior as the TIFF plugin 2023-09-25 23:02:37 +02:00
18ea0492bc raw: fix multi image load
Fixes not loading a second image in the file. This patch allow code like the following.

QImageReader r(file);
do {
    auto qi = r.read();
    if (!qi.isNull()) {
        qi.save(QString("/tmp/%1_%2.tif")
                .arg(QFileInfo(file).baseName())
                .arg(r.currentImageNumber()));
    }
}
while (r.jumpToNextImage());

m_startPos is used to reposition the device if you decide to do a subsequent read: libraw wants it to be at the beginning of the RAW stream
2023-09-25 20:55:53 +00:00
7899c27a80 exr: write support and more
- Added support for writing EXR files
- Large image support (tested with 32GiB 16-bit image)
- OpenEXR multithreaded read/write support through the use of line blocks
- Build option to enable conversion to sRGB when read (disabled by default)
- Multi-view image reading support
- Options support: Size, ImageFormat, Quality, CompressRatio
- Metadata write/read support via EXR attributes

The plugin is now quite complete. It should also work on KF5 (not tested): if there is the will to include this MR also on KF5, let me know and I will do all the necessary tests.
2023-09-17 08:07:47 +00:00
6a51407556 Remove unused Qt5 code 2023-09-15 13:29:13 +02:00
75e1280073 hdr: options support and bugfixes
- Support for Size and Format options
- Added compile option to generate 16-bit instead of 32-bit images
- Includes MR !189 and MR !192 fixes
2023-09-11 09:08:18 +00:00
0a6fbd88e9 xcf: fix crash (oss-fuzz issue 62075) 2023-09-07 16:12:41 +00:00
fbf60f8bbb xcf: fix possible overflow
Port to KF6 of MR !187
2023-09-05 11:32:32 +00:00
2799382c21 Drop code for Qt < 6.5.0
...now that we depend on Qt >= 6.5.0.
2023-08-30 00:27:47 +02:00
adc7da4f41 GIT_SILENT Upgrade Qt6 version requirement to 6.5.0. 2023-08-29 23:31:26 +02:00
ac808679cd qoi: initialize structure before use
It was reported by Code Quality scans as Critical (CWE-457)
2023-08-29 21:04:00 +02:00
2aea982e9e qoi: fix reports from quality scanner
struct QoiHeader is initialized to invalid values prior use,
it’s good to detect situations when we read incomplete data.
Add include in scanlineconverter.cpp so it can be used without
change in kf5 branch.
2023-08-29 16:22:52 +02:00
9173f02ea3 ras: rle decode
Added support for RLE compressed images. This patch makes the player almost complete allowing to read all type 1,2 and 3 RAS files. Only types 4 and 5 are missing which are images converted from TIFF and IFF.
2023-08-29 09:11:35 +00:00
4badb3088e Support libavif 1.0
Make cmake find libavif 1.0 and adapt to API changes (which is reverting to pre 0.9.2 API)
2023-08-29 09:21:37 +02:00
8dc685df26 qoi: write support
As a base I used the reference implementation found on the official site at https://qoiformat.org/ (MIT license).
I added a class to convert scan lines in scanlineconverter.cpp. The class takes advantage of the QImage conversion and contrary to what one might expect, with large images it improves performance (compared to converting the whole image) 😄 

In progressive mode, for each line, the following conversions (only if needed) are made before saving:
1. If the icc profile is set, the line is converted to sRGB or sRGB Linear.
2. The line is scaled to 8 bits with RGBA order.
2023-08-28 22:25:10 +00:00
4bd9d5baec No longer needed to explicitly include CMakeParseArguments
NO_CHANGELOG
2023-08-28 22:54:41 +02:00
79e8e183eb ras: code revamped
- Progressive load from file
- Added support for 1-bit image
- Images with palette are now Index (instead of RGB32)
- Added options support (Size, Format)
- Added some test cases
- Improved performance by directly accessing the scanline
- Support for more RAS extension (taken from GIMP)

The code should works "as is" also on KF5.
2023-08-28 18:02:02 +00:00
7d63a1d8fa exr: multiple fixes
- Support for images with transparency
- Precise colorspace conversion using QT color spaces
- Set the correct resolution
- Set useful metadata
- Support for RGBX16FPx4 format in Qt 6
- Speed improvements

![image](/uploads/bb36492d71acce4995e8b4229a813031/image.png)
2023-08-28 17:30:50 +00:00
c11c5eff4f xcf: format v12 support
This is a patch over MR !108 by @sandsmark. Martin has done a great job implementing support and I find it a shame not to use it.

I made sure that the results are the same as the current version and fixed the problems of pixels with wrong colors with color depth grater than 8 bits. I also fixed conversion errors on mask and gray images (16/32 bits).
Unfortunately the internal rendering engine of the original code is 8-bit so I always forced the output of 8-bit images to correct the problems (see image below). Since it is a plugin with a "rendering engine", the tests to seriously validate it are potentially endless (as the original version is not perfect).

Errors of the original version of the MR (right) which should no longer occur:
![image](/uploads/9ef24eb5436bd19ff1fb428242a9c119/image.png)
2023-08-28 17:27:08 +00:00
c02bf3dbcc Readme.md: Update supported formats list
- (+) Krita (kra)
- (+) OpenRaster (ora)
- (-) XView (xv)
2023-08-20 08:04:21 +00:00
6254529d2d qoi: fix buffer overflow
- fix buffer overflow with corrupted images without image data
- fix unable to read very small images (e.g. 1x1 px)
- new test cases added
- detect incomplete files by checking the end of streams as written in the specs
2023-08-18 14:09:00 +00:00
35ff3efbbc hdr: improve precision
- Improve the precision of HDR format (it is a floating point format) by using the RGBA32FPx4 image format.
2023-08-13 22:19:22 +00:00
7a0d95af92 Renamed qoi.h to qoi_p.h 2023-08-12 23:47:29 +02:00
4c3ade04dd Minor improvements 2023-08-12 09:03:56 +02:00
b209e54b6f Add support for the QOI image format
This MR adds read-only QOI (https://qoiformat.org/) image format support for KImageFormats.

This format has received it's MIME type inclusion in shared-mime-info 4 months ago: ff51a0a9e3

The code is based on the reference QOI implementation at https://github.com/phoboslab/qoi/blob/master/qoi.h

Official test images: https://qoiformat.org/qoi_test_images.zip

![pngvsqoi](/uploads/e386aa5057641057106e21940c770d97/pngvsqoi.png)

Also: This is my first MR to KDE ;)
2023-08-11 20:44:17 +00:00
4dc2099fa4 Set linear color space for proper viewing 2023-07-21 14:17:11 +02:00
491b223c15 psd: Fix UB type punning
BUGS: 471829
2023-07-16 08:07:13 +00:00
6559bf8994 Treat 3-channel MCH images as CMY images 2023-07-03 12:34:54 +02:00
34ed3bad27 Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-02 03:08:44 +02:00
9c579fc1f8 jxl: add support for libjxl v0.9, drop support for old 0.6.1 2023-06-27 14:32:08 +02:00
93adb22632 raw: change the use of the quality parameter
- Standardized the quality parameter between 0-100
- The value -1 is the default value of Qt plugins and is managed
- Negative values other than -1 are used as flags to activate the custom mode
2023-05-17 17:45:23 +00:00
d57ff91f8b 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.
2023-05-12 08:53:50 +00:00
edd6adcbac Avoid unnecessary conversions 2023-05-10 15:34:14 +02:00
d787c12727 RGB/SGI writer: fix alpha detection and image limit size 2023-05-10 11:43:21 +00:00
c9fec5e408 TGA writer: fix alpha detection and performance improvements 2023-05-10 11:43:21 +00:00
e60dfd4968 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
2023-05-10 11:43:04 +00:00
f5a9dd46d2 Removed unused jxl.desktop file 2023-04-22 09:31:30 +02:00
41f0411b62 PSD: fix test failure on some systems and fix wrong check on alpha conversion
- Fix PSD alpha conversion
- Fix autoread test to use also TIFF images
2023-04-18 22:14:41 +00:00
e1a3751936 CMake: make use of qt_add_plugin for plugins
Currently it will only produce shared library binaries as plugin.
This could make building static imageformats plugin much easier.

Related: https://invent.kde.org/frameworks/kimageformats/-/issues/4
2023-03-30 03:42:41 +00:00
402dfb5de3 psd: Fix alpha blending
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.
2023-03-29 17:55:55 +00:00
a3f7c03b61 heif: Add format read-write support in README 2023-02-15 08:36:24 +00:00
20cec27ae8 Fix writing TGA alpha depth flag
Correctly write alpha channel depth as 8-bit.
2023-02-01 16:26:31 -06:00
d34c1668aa Bump Qt deprecation level to 6.4 2023-02-01 17:16:45 +01:00
560d0483ae Replace deprecated functions
Improve the code by replacing deprecated functions as suggested by the Qt documentation.
2023-01-31 21:32:30 +00:00
085c9c4841 HDR format removed from RAW plugin 2023-01-30 21:58:36 +00:00
b654f20ece heif: reject invalid files with zero size 2023-01-29 16:16:52 +01:00
21211cd63b psd: LAB conversion speed improved
Using an approximated pow function improves the conversion speed of LAB images by more than 50% without an appreciable visual difference.
2023-01-27 23:19:48 +00:00
5cc7a2b45c psd: native 32-bits RGB support
This patch maps RGB 32-bits PSD to QImage::Format_RGBA32FPx4 or QImage::Format_RGBX32FPx4.
2023-01-26 23:17:09 +00:00
4451737d2f Remove Qt 5 support 2023-01-24 17:15:14 +01:00
01ab0876f1 Debug code removed 2023-01-22 11:04:48 +01:00
a67dcac7d1 LAB/CMYK conversion speed improved by ~10% 2023-01-22 10:57:54 +01:00
cef8d08ad4 Bump KF_DEP_VERSION for KF6 2023-01-21 13:30:04 +01:00
a4b9dd9400 Rename CMake targets/config/libraries for KF6 2023-01-20 23:58:58 +01:00
6e6c1ab5f4 Require Qt6
master is for Qt6-based development now

Qt5 development continues in the 'kf5' branch
2023-01-18 23:37:26 +01:00
f205adf2e0 Remove Qt5 CI
master is Qt6 now
2023-01-18 23:37:26 +01:00
14742cb502 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
2023-01-11 22:56:38 +00:00
4c6d2b92b6 GIT_SILENT Upgrade ECM and KF version requirements for 5.102.0 release. 2023-01-07 00:28:55 +00:00
05bd9397b3 raw: tweak seek implementation
libraw uses fseek when doing files, which allows seeking past the end
without problems, so do the same, otherwise when we report oss-fuzz
issues they say "give me an example to reproduce" and since our seek
and their seek don't behave the same it's hard to convince them
to fix their code
2022-12-14 23:56:20 +01:00
f4ca3f6783 heif: fix error handling 2022-12-13 11:11:38 +01:00
a30f043e5d heif: rewrite plugin to use only libheif C API
Using C-API instead of C++ libheif API has following advantages:
- More libheif features available (for ex.: strict decoding)
- Linking with static build of libheif is possible
- No need to enable exceptions
2022-12-05 22:43:41 +01:00
7af4eea253 GIT_SILENT Upgrade ECM and KF version requirements for 5.101.0 release. 2022-12-03 09:47:44 +00:00
a3049f6740 Fix missing DCI-P3 color space set 2022-11-24 15:02:31 +01:00
3b1e8f7054 minor tweaks in HEIF and AVIF plugins
It is mostly only about casting between types.
2022-11-19 11:38:49 +00:00
dcab3a06ab raw: LibRaw_QIODevice::read: fixed possible partial reading of an item
- If the size of an item is greater than 1 byte, it must be ensured that it is not partially read.
- In many readings, LibRAW gives an error if a partial number of items are read so I always try to read everything.
2022-11-19 10:14:16 +00:00
361f9e867e PSD multichannel testcases 2022-11-15 16:25:22 +00:00
35883aa604 Support to MCH with 4+ channels (treat as CMYK) 2022-11-15 16:25:22 +00:00
50846f224f avif: Check if encoder/decoder is available in capabilities()
The plugin can be compiled even with decoder libraries only. In a similar way of HEIC plugin I check if an encoder or a decoder is available.
2022-11-15 13:14:09 +00:00
9ad82ed608 Fix condition for installing desktop files 2022-11-07 00:37:09 +01:00
c9f32a226f GIT_SILENT Upgrade ECM and KF version requirements for 5.100.0 release. 2022-11-05 12:28:10 +00:00
a0df142408 Don't install desktop files for image formats when building against Qt6
These are only for kdelibs4support/KServiceTypeTrader
2022-11-03 21:36:38 +01:00
8586bb4719 raw: Don't seek back if we were asked to read too much
Otherwise we will return false when LibRaw::derror
calls for eof() when it is actually that we have reached eof
2022-10-30 23:59:55 +01:00
d734f28727 jxl: indicate when all frames have been read
and return correct loop count
2022-10-18 17:58:40 +02:00
afa7399b36 avif: minor fixes
libavif 0.11.0 uses new default dimension limit 32768 pixels,
we allow 65535 which was used by us previously.
Minor tweaks in jumpToNextImage, jumpToImage
to handle rare situations.
2022-10-18 15:05:15 +02:00
bfb12093ad avif: indicate when all frames have been read 2022-10-15 20:08:39 +02:00
1190e53e9b avif: always indicate endless loop
avif does not support loops but endless loop was the behavior before
460085 was fixed, so a workaround is added.

See also: https://github.com/AOMediaCodec/libavif/issues/347

CCBUG: 460085
2022-10-15 14:11:56 +08:00
350ce1b990 avif: return false in canRead() when imageIndex >= imageCount
Otherwise when `cache: false` is set in AnimatedImage, QMovie will try
to read the image forever.

BUG: 460085
FIXED-IN: 5.100
2022-10-15 14:02:38 +08:00
bcbf45e23a Add JXL test files corresponding to 8 EXIF orientation values 2022-10-13 15:47:04 +02:00
c71a7984d6 Add AVIF test files with rotation and mirror operations 2022-10-12 15:39:27 +02:00
b1f3a87896 Auto-rotate input images in readtest
Currently, there is no difference in the tests but in the future
we will add images with various transformations defined.
2022-10-12 15:33:08 +02:00
8af9a0f9d9 jxl: remove C-style casts 2022-10-11 15:38:55 +02:00
3790a89cd1 avif: Use reinterpret_cast instead C cast
No longer using int for QByteArray size because Qt6 uses qsizetype
2022-10-11 15:05:20 +02:00
f475a4b24a avif: revert 9ac923ad09 commit
Changes to libavif's avifImageRGBToYUV() API were reverted too.
2022-10-11 14:36:17 +02:00
d2f38b8b9c heif: replace C cast with static_cast 2022-10-10 09:28:41 +00:00
9ab64dbf22 heif: use heif_init/heif_deinit with libheif 1.13.0+
In recent libheif, application should use
heif_init/heif_deinit calls. Unfortunately, these calls are
not thread-safe in released 1.13.0 version yet (will be in the
future) and HEIFHandler is often created in different threads.
So we have to guard their use with a mutex.
2022-10-10 09:28:41 +00:00
20f74ce5e6 FindLibRaw: fix include dir, should not contain prefix libraw/
See also the examples at https://www.libraw.org/docs/API-CXX.html

BUG: 460105
2022-10-08 02:15:18 +02:00
54129819d5 Fix duplicated tests 2022-10-02 06:01:23 +00:00
181eb253c6 ANI partial test and PIC test added 2022-10-02 06:01:23 +00:00
c5f7ea7eac PSD: impreved support to sequential access device 2022-10-02 06:01:23 +00:00
ea14882ff7 Fix messages 2022-10-02 06:01:23 +00:00
f8bfdce285 CMakeLists: enable EXR test 2022-10-02 06:01:23 +00:00
524f083ee4 Added EXR test image 2022-10-02 06:01:23 +00:00
c96ad6ba8a Fixes for sequential devices 2022-10-02 06:01:23 +00:00
49bd131eef GIT_SILENT Upgrade ECM and KF version requirements for 5.99.0 release. 2022-10-01 13:17:36 +00:00
2a25ec7a56 Add Qt6 windows CI support 2022-09-27 15:15:36 +00:00
a8a477ae67 pcx: Do not support sequential devices
We need QIODevice::pos() to work in QDataStream &operator>>.

BUG: 459541
2022-09-24 03:45:21 +02:00
2f27dff48b Fix maximum number of channels (testcase added) 2022-09-22 21:17:10 +00:00
72a1cc23b1 Use consistently std::as_const instead of qAsConst
NO_CHANGELOG
2022-09-22 15:59:15 +02:00
6f3a326cf8 LibRaw_QIODevice::seek() avoid seek on a sequential device 2022-09-21 02:14:55 +02:00
d881a7bbb1 LibRaw_QIODevice::seek() bounding checks 2022-09-20 19:44:08 +02:00
65a20b43fc Camera RAW images plugin
Plugin to read RAW camera images based on LibRAW.

- Supersedes MR !86 
- Support to LibRaw 0.20 and 0.21-Beta
- Support to multi-shot images: use imageCount(), jumpToImage() to select the wanted shot
- By default generates 16-bits sRGB images using camera white balance and interpolation AHD
- Should fix CCBUG: 454208: on my Debian with KF5.96 and the pulgin installed, I see the preview of all my RAW files (ARW included) in Dolphin

News compared to V1 (MR !86)

- Fix possible stack overflow due to the huge size of LibRaw class
- Fix image allocation with Qt 6 (make use of QImageIOHandler::allocateImage()) 
- Support to XMP metapacket
- Support to quality option. For e.g. you can focus on quality (q = 10) or speed (q = 1)
- oss-fuzz available [here](https://github.com/mircomir/oss-fuzz/tree/raw_fuzz/projects/kimageformats)
2022-09-19 23:52:43 +00:00
84941b7690 .gitlab-ci.yml: enable static builds 2022-09-18 18:41:54 +00:00
21928300c6 Enables opening of XCF files with Width and/or Height greater than 32K 2022-09-13 17:57:57 +00:00
024d199ed0 Replace C cast with reinterpret_cast 2022-09-11 11:01:55 +02:00
9ac923ad09 avif: adjust for libavif breaking change in YUV<->RGB conversion 2022-09-09 17:54:18 +02:00
feb6d9b20f Fix image allocation with Qt 6
To make the plugins fail to allocate if the image size is greater than QImageReader::allocationLimit() it is necessary to allocate the image with QImageIOHandler::allocateImage().

Note that not all plugins have been changed and some others are not tested in the CI (maybe due to missing libraries).

PS: the following message is printed by QImageIOHandler::allocateImage() if the size is exceeded: "qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of XXX megabytes"
2022-09-07 14:03:33 +00:00
dfbc6e0f8c GIT_SILENT Upgrade ECM and KF version requirements for 5.98.0 release. 2022-09-05 09:27:11 +00:00
43543f96bc Add FreeBSD Qt6 CI support 2022-08-25 08:20:16 +02:00
62e477a6f2 Protect against too big resize for a QByteArray
oss-fuzz/48480
2022-08-15 10:24:40 +00:00
e6955e1f03 GIT_SILENT Upgrade ECM and KF version requirements for 5.97.0 release. 2022-08-07 12:18:50 +00:00
6074c4d6fd Use right type on enums 2022-07-29 07:46:10 +02:00
6f44c5c52a PSD: Improve alpha detection
BUG: 182496
2022-07-25 19:34:57 +00:00
d030c75925 PSD: LAB support
LAB images support:
- Added LAB 8/16-bits support by converting them to sRGB
- The conversion are done using literature formulas (LAB -> XYZ -> sRGB): [sRGB on Wiki](https://en.wikipedia.org/wiki/SRGB), [LAB on wiki](https://en.wikipedia.org/wiki/CIELAB_color_space)
- Removed unused code
2022-07-06 21:30:23 +00:00
9b3133ac92 GIT_SILENT Upgrade ECM and KF version requirements for 5.96.0 release. 2022-07-02 14:33:58 +00:00
b0a0bb1294 PSD header checks according to specifications 2022-06-30 06:56:21 +00:00
3d5090593c Improved detection of alpha channel on CMYK images 2022-06-30 06:56:21 +00:00
d4966d169b Minor code optimization 2022-06-30 06:56:21 +00:00
bf52896347 Minor code improvements (tested on all my MCYK PSD/PSB files) 2022-06-30 06:56:21 +00:00
c52ffa2227 Fix Alpha + testcase images 2022-06-30 06:56:21 +00:00
e4e386babf Fix regression 2022-06-30 06:56:21 +00:00
b47a9d7022 Basic support to CMYK 8/16 bits (not fully tested) 2022-06-30 06:56:21 +00:00
2cbf815d1f Require passing tests for the CI to pass 2022-06-29 20:09:38 +02:00
6cd0056f3b Use ECMDeprecationSettings, bump hidden deprec. API to KF 5.95
NO_CHANGELOG
2022-06-28 00:35:18 +02:00
83374f390e Fix missing init of oneValueArgs variable
NO_CHANGELOG
2022-06-28 00:17:56 +02:00
5e59d950bd jxl: support both old 0.6.1 and new 0.7.0 libjxl API
New libjxl API changed the way how lossless 16bit depth images
must be encoded: codestream level 10 must be set,
which implies use of container format.
Unfortunately, there isn’t version number inside libjxl header yet,
so we must detect new version on cmake/PkgConfig level.
2022-06-22 22:21:33 +00:00
de320447f6 Remove extra ';' 2022-06-22 19:52:13 +02:00
cf375a207f avif: read performance improvements 2022-06-20 18:50:03 +02:00
2aec1d3926 GIT_SILENT Upgrade ECM and KF version requirements for 5.95.0 release. 2022-06-04 08:19:33 +00:00
2a84dd677d psd: Fix segfault on architectures where char is unsigned (like ARM) 2022-05-27 12:26:56 +03:00
ebcc34519c avif: prepare for breaking change in libavif 2022-05-02 11:46:37 +02:00
cff2604cf9 XCF: Support to QImageIOHandler::Size option 2022-04-29 13:23:20 +00:00
f8a251e268 Support to QImageIOHandler::Size option 2022-04-28 08:52:18 +02:00
52134fc2e9 QByteArray resize removal
- Removed QByteArray resize with potentially large numbers as in merge request !66
2022-04-14 23:04:58 +00:00
343954ca98 psd: Fix crash on broken files
Instead of resizing the bytearray to the potential size and then reading
into it, ask the device to read into a bytearray, this way instead of a
crash because we're trying to resize to a too big number we get a nice
  maxSize argument exceeds QByteArray size limit
warning

oss-fuzz/46664
2022-04-13 23:07:22 +02:00
44fd6b7bc0 psd: duotone read
- New format added: Duotone
- Fix float to int conversion round issue
2022-04-11 21:07:23 +00:00
c8a0806aab psd: Don't crash with broken images
Found by oss-fuzz but still with an unfiled bug number
2022-04-10 12:19:52 +02:00
bb475dedd1 psd: Header depth has to be 8 for CM_INDEXED color_mode
As suggested by Mirco Miranda
2022-04-07 23:50:15 +02:00
9e28aae868 psd: Protect against broken images
If you have an image that says it's Mono but has 16 as header.depth we
end up doing invalid memory accesses

oss-fuzz/46437
2022-04-07 21:46:08 +00:00
5c47a97b79 psd: Don't abort on broken images
oss-fuzz/46418
2022-04-06 22:58:31 +00:00
84d56d00cf avif: lossless support 2022-04-06 16:13:10 +00:00
384f78a13c psd: Don't assert on broken files
oss-fuzz/46407
2022-04-06 00:16:38 +02:00
72fc32aefc Add windows CI 2022-04-05 15:45:38 +02:00
98f19c60ae PSD: Performance improvements and support to missing common formats
- Supersedes merge request !55 (PSB support, XMP metadata, ICC color profile, image resolution read)
- Performance improvements: 5 time faster than previous version (tested on a 3.9GB PSB: 9sec instead 47sec)
- New formats support added: INDEXED (8bps), BITMAP (1bps), GRAYSCALE (8, 16, 32bps), RGB (32bps)
- Should fix Bug https://bugs.kde.org/show_bug.cgi?id=397610
- Fix Bug https://bugs.kde.org/show_bug.cgi?id=428238
2022-04-04 17:22:45 +00:00
ae6b724824 GIT_SILENT Upgrade ECM and KF version requirements for 5.93.0 release. 2022-04-02 10:00:12 +00:00
3e751dd80d Fix XCF parasites metadata in QImage and support to ICC profile
- Fix parasite "gimp-comment" not set due to null QImage
- Support to parasite "icc-profile" using Qt 5.14+ API
- Added parasite "gimp-image-metadata" as QImage metadata "XML:org.gimp.xml"
- Added a XCF with XML metadata and icc prifile embedded in autotest folder (generated by GIMP 2.10.30)
- Tested with Qt 5.15.2 and Qt 6.2.3 under Windows and Qt 6.2.3 under macOS
2022-03-23 23:34:33 +00:00
e69dff73e6 avif: encoder speed 7->6 2022-03-10 09:44:50 +01:00
64cfe52bee avif: fix jumpToImage 2022-03-10 09:39:53 +01:00
8732fc8487 avif: warn about non-recommended libavif configuration 2022-03-10 09:35:08 +01:00
d9729b7190 GIT_SILENT Upgrade ECM and KF version requirements for 5.92.0 release. 2022-03-05 11:15:00 +00:00
55d3c568b2 Add Qt6 Android CI 2022-03-01 16:04:48 +00:00
4afafee6c1 Add write tests for heif/avif/jxl
Unfortunately none of them pass since it seems they can't load a png,
save it to their format with loseless quality and read it back and get
exactly the same contents than the png
2022-02-18 00:05:01 +01:00
f04084e175 jxl: encoding improvements
Plug-in can save in 8bit depth now,
previously only 16bit was supported.
Memory and dimension limits were adjusted.
2022-02-16 10:26:56 +01:00
9911c9c2ea avif: adjust dimension and memory limits
With or height can be above 32k now (up to 64k), but
image should not have more than 256megapixels
(Default memory limit of libavif)
2022-02-11 16:01:07 +01:00
4ceef5164d GIT_SILENT Upgrade ECM and KF version requirements for 5.91.0 release. 2022-02-05 15:14:16 +00:00
3d2d91a08a Fix typo, should be qCWarning
GIT_SILENT
2022-02-03 16:34:06 +02:00
0a02458560 Check executables exist in PATH before passing them to QProcess
See:
https://kde.org/info/security/advisory-20220131-1.txt
https://mail.kde.org/pipermail/kde-devel/2022-January/000943.html
2022-02-03 11:32:24 +02:00
96836e849f Fix handling of null terminated ANI metadata with Qt6
In Qt5 converting a QByteArray to a QString stops at the first null byte,
in Qt6 the QByteArray size is respected, and trailing null bytes are
therefore included in the final QString. Explicitly determine the length
of the string data to deal with that.
2022-01-22 22:03:21 +01:00
f4edb7296f Add CI qt6 support 2022-01-08 09:27:14 +01:00
56376ffd66 GIT_SILENT Upgrade ECM and KF version requirements for 5.90.0 release. 2022-01-01 12:16:00 +00:00
f534254063 GIT_SILENT: It compiles fine without deprecated methods 2021-12-26 11:35:54 +01:00
32347725cb Fix typo 2021-12-21 20:28:05 +01:00
56e762c563 Make it compile against qt6 2021-12-21 20:10:11 +01:00
81603ed908 GIT_SILENT Upgrade ECM and KF version requirements for 5.89.0 release. 2021-12-04 17:00:59 +00:00
957c199c68 GIT_SILENT: add missing licences 2021-12-02 07:14:54 +01:00
f445e5dd0a avif: limit scope of variables 2021-11-29 17:35:51 +01:00
d3da56bba3 Add JXL to the list of supported formats 2021-11-17 20:06:11 +01:00
41c4b5930c Add plugin for JPEG XL (JXL) 2021-11-10 16:01:58 +01:00
fb66044714 Add FreeBSD CI 2021-10-07 00:28:35 +02:00
a43394a759 Add Android CI 2021-10-07 00:04:08 +02:00
904c251f50 GIT_SILENT Upgrade ECM and KF version requirements for 5.87.0 release. 2021-10-02 12:18:49 +00:00
2f9e09f04a Add Gitlab CI configuration 2021-09-29 21:55:22 +13:00
6458c9ae52 avif: performance and quality improvements
Enable decoder to use more threads.
8bit YUV->RGB conversion is significantly faster
when AVIF_RGB_FORMAT_RGBA format is used,
because libavif can use libyuv to perform conversion quickly.
Prefer faster AVIF_CHROMA_UPSAMPLING_FASTEST when decoding animation.
Encoder speed changed from to 8 to 7.
Recent AV1 encoders got faster,
so it is OK to switch to better compression quality.
Remove obsolete image/avif-sequence mime-type
as it was merged with image/avif.
2021-09-22 11:53:46 +02:00
45cd128f73 GIT_SILENT Add CI configuration file 2021-09-05 14:03:42 +02:00
e89d21f12d GIT_SILENT Upgrade ECM and KF version requirements for 5.86.0 release. 2021-09-04 15:45:36 +00:00
1d2b51ddf1 Fix build with clang12 + libc++ 2021-08-30 20:29:23 +02:00
1080976abe GIT_SILENT: we can use std::as_const directly 2021-08-28 18:07:43 +02:00
abd550c60c GIT_SILENT: replace MacOSX with macOS 2021-08-25 14:56:21 +02:00
aade392da3 Clean up unneeded JSON parameter in kimageformats_add_plugin
The moc process already rebuilds the plugin when the JSON file changes, consequently the additional parameter is not needed.

Task: https://phabricator.kde.org/T14649
2021-08-24 12:06:06 +02:00
7642633551 SGIImage::writeImage: Properly fail if the image is too big 2021-08-19 17:29:44 +02:00
9f2c5061c8 exr: Port to std::log/pow
The Imath functions are marked as deprecated and they just call the
std::log/pow anyway
2021-08-18 21:51:53 +00:00
28099eed71 GIT_SILENT Upgrade Qt5 version requirement to 5.15.2. 2021-08-15 08:56:59 +00:00
f5d574b3ad clang-tidy: one declaration per line; braces around statements
clang-tidy checks:
readability-isolate-declaration and readability-braces-around-statements

KF task: https://phabricator.kde.org/T14729

GIT_SILENT
2021-08-13 15:13:21 +02:00
a8f92e5525 PCXHandler::write: Properly fail if the image is too big 2021-08-12 16:43:52 +02:00
fbeef559b7 exr: Repair compability with openexr2
BUGS: 440084
2021-07-21 00:04:45 +02:00
7f56d835f0 GIT_SILENT Upgrade ECM and KF version requirements for 5.85.0 release. 2021-07-14 22:32:29 +00:00
8f87ce4cb2 Fix typos found by codespell
GIT_SILENT
2021-07-14 00:08:38 +02:00
5aa03c12ad exr: Override the actual function signature
For gcc there's a typedef that makes it work, but seems clang in macos is
not so lucky

BUGS: 439767
2021-07-12 20:15:12 +02:00
3266a9c466 Fix build with older openEXR versions
Dynamic exception specification is not allowed in c++-17. The enforcement needs
to be relaxed for the kimg_exr plugin when using openEXR versions older than 2.3.0.
2021-07-08 12:56:30 +02:00
1b2bf6e931 Remove CMAKE_CXX_STANDARD, now set to 17 in KDEFrameworkCompilerSettings in ECM
NO_CHANGELOG
2021-06-19 20:05:41 +02:00
894391b000 GIT_SILENT Upgrade ECM and KF version requirements for 5.84.0 release. 2021-06-19 15:58:16 +00:00
ef6be2c077 avif: Disable all strict decoder checks
New libavif 0.9.1 apply some very strict standard compliance
checks by default. Unfortunately, it rejects many files made by
libheif-based apps (GIMP, ImageMagick) in the past.
libheif 1.12.0 (released on May 5, 2021) addressed the problem,
but it would be good to extend grace period, allowing other
projects and distributions to upgrade to fixed version.
2021-06-08 15:20:41 +02:00
96b40da089 GIT_SILENT Upgrade ECM and KF version requirements for 5.83.0 release. 2021-06-05 08:55:28 +00:00
bf3f94da76 avif: Adjust for libavif breaking change 2021-06-04 14:37:10 +02:00
318dacda75 Remove compiler flags already defined in extra-cmake-modules
-DQT_NO_FOREACH

GIT_SILENT
2021-05-23 17:18:51 +02:00
e358bb0feb Bump required CMake version to 3.16
KF6 task: https://phabricator.kde.org/T14467
2021-05-17 13:21:23 +02:00
dca6e87c89 Enable HEIC plugin to save all ICC profiles 2021-05-14 12:30:28 +02:00
62f9af9a35 Color profile loading/saving fixes
Allow saving Qt-unsupported variants of ICC profiles, they could be
correctly handled by apps with wider color management support.
Change way how QColorSpace is created to avoid
rare problems in some apps.
2021-05-13 16:56:46 +02:00
ff53d3d7e9 xcf: Make sure offsets are not negative
It's not a huge problem since QIODevice::seek() is a noop on negative values but it's
just better to bail out as soon as possible when we realize the file is
broken
2021-05-05 17:23:59 +02:00
780f342825 GIT_SILENT Add auto generated files to .gitignore 2021-05-02 12:48:16 +02:00
297ed9a2fe xcf: Fix Stack-buffer-overflow WRITE on broken files
oss-fuzz/33742
2021-05-02 09:50:50 +00:00
55b4077f2c GIT_SILENT Upgrade ECM and KF version requirements for 5.82.0 release. 2021-05-01 09:42:14 +00:00
2429c95336 Support building with OpenEXR 3
Try to find OpenEXR 3 first via the upstream cmake config and fallback to using our FindOpenEXR
2021-04-24 10:17:25 +00:00
224f892b09 GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2021-04-11 12:05:38 +02:00
64fa129ed6 GIT_SILENT Add auto generated files to .gitignore 2021-04-07 21:06:01 +02:00
3cb4021afc test: imageconverter: add a way to list mimes instead of formats 2021-04-05 09:44:03 +00:00
95a19a15c3 xcf: fix new[]/delete mismatch, as detected by ASAN 2021-04-04 17:30:52 +02:00
1ba23a1e8e Port away from QPrinter::setPaperSize, deprecated in Qt 5.15
The formula was found in Qt's qt_pixelMultiplier (qpagesize.cpp)
as called by the deprecated setPaperSize method (when the unit is
DevicePixel)

NO_CHANGELOG
2021-04-04 15:56:13 +02:00
bc3c04c7ce GIT_SILENT Upgrade Qt5 version requirement to 5.15.0. 2021-04-04 14:44:40 +02:00
2755f74fbb ani: convert +1 to -1 so we don't do a potential integer overflow
oss-fuzz/32601

runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
2021-04-03 22:46:33 +00:00
3b0c767f82 GIT_SILENT Upgrade ECM and KF version requirements for 5.81.0 release. 2021-04-03 09:33:41 +00:00
e80fcd7c30 GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2021-03-27 11:37:36 +01:00
a73e3d44dd Add .git-blame-ignore-revs
GIT_SILENT
2021-03-09 02:18:09 +02:00
1169859b07 Run clang-format on all cpp/h files
NO_CHANGELOG
2021-03-08 20:15:33 +02:00
04e276dcb3 Add clang-format bits to CMakeLists.txt
GIT_SILENT
2021-03-08 20:14:48 +02:00
e3ab850712 Add a trailing comma to enum
Should help produce better diffs and clang-format won't squash the enum
on one line.

GIT_SILENT
2021-03-08 20:14:42 +02:00
503b3eee2b Fix Non-square Radiance/RGBE/.hdr images failing to load
The HDR QImageIOHandler plugin only supports the default image orientation (-Y +X) in .hdr files. It mixes up the width and height however, resulting in non-square images not loading.

This fix adds a check for the standard image orientation in the file and returns false (with error message) if that fails.
If it succeeds, it takes the height from the -Y component, and the width from the +X component, resulting in successful loading of the image.

Add autotest images for landscape and portrait HDR (Radiance RGBE) loader

BUGS: 433877
2021-03-04 22:57:23 +01:00
511a22f0b4 Check the input buffer before passing it to libheif 2021-03-02 11:46:13 +00:00
c532227d43 GIT_SILENT Upgrade ECM and KF version requirements for 5.80.0 release. 2021-02-28 18:59:05 +00:00
1462c3abd6 Check primaries returned from libavif
Due to various double vs float arithmetic,
some primaries could be rejected by Qt.
If necessary, we adjust the values so they
will be accepted by Qt.

Remove newline from the ends of error strings.
2021-02-27 19:11:56 +01:00
ca52d4ddf5 Add plugin for High Efficiency Image File Format (HEIF)
Code partially by Sirius Bakke
2021-02-25 11:52:00 +01:00
7ba4d6adda GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2021-02-13 14:41:28 +01:00
0aaab103b1 Add compile_commands.json to .gitignore
See https://invent.kde.org/sdk/kdesrc-build/-/merge_requests/82

GIT_SILENT
2021-02-11 14:27:34 +02:00
8b9125c913 Quality option can be returned without parsing input file. 2021-02-08 10:00:53 +01:00
8845dd9818 Simplify portion of NCLX color profile code 2021-02-02 09:28:32 +01:00
a4b8295625 [imagedump] Add "list MIME type" (-m) option
Allows listing the supported mime types
2021-01-31 20:49:16 +01:00
134c96fa61 GIT_SILENT Add auto generated .clang-format file to .gitignore 2021-01-30 18:39:11 +01:00
3673874a63 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.79.0 release. 2021-01-29 20:44:46 +00:00
8ad43638ad Fix crash with malformed files
oss-fuzz/29284
2021-01-08 14:02:45 +00:00
c72c9f577b ani: Make sure riffSizeData is of the correct size before doing the quint32_le cast dance
oss-fuzz/29290
2021-01-05 21:52:24 +01:00
bf3f99abf5 Add missing includes 2021-01-03 10:05:53 +01:00
b79d1f222d Add plugin for animated Windows cursors (ANI) 2021-01-03 08:49:10 +00:00
bf1de9f8f0 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.78.0 release. 2021-01-02 12:27:55 +00:00
82d5e0f8a4 Remove ifdefs, we require Qt 5.14 now 2020-12-18 19:34:07 +01:00
bbf945137a GIT_SILENT Upgrade Qt5 version requirement to 5.14.0. 2020-12-18 19:02:54 +01:00
54ed1dda27 Add AVIF to the list of supported formats 2020-12-16 08:36:39 +00:00
34a9ec1b06 Add plugin for AV1 Image File Format (AVIF) 2020-12-13 22:23:27 +00:00
a6ec69d276 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.77.0 release. 2020-12-05 10:09:13 +00:00
02cbf3889f GIT_SILENT Upgrade Qt5 version requirement to 5.13.0. 2020-11-27 00:45:24 +01:00
6cf05cf305 test: don't convert image format if possible 2020-11-10 13:03:37 +08:00
938b8126b5 No longer descease color depth to 8 for 16 bit uncompressed PSD files 2020-11-10 13:03:37 +08:00
d36c191351 tests: Remove qimage_format_enum_names and just use QMetaEnum 2020-11-09 19:15:36 +00:00
1acb5a6177 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.76.0 release. 2020-11-07 11:39:10 +00:00
f2ccbf1724 Add test case for RLE compressed 16 bpc PSD files. 2020-11-06 15:04:04 +08:00
5825c83235 Add support for RLE-compressed, 16 bits per channel PSD files. 2020-11-06 15:02:29 +08:00
b742cb7cc7 Return unsupported when reading 16bit RLE compressed PSD files 2020-11-01 11:50:48 +08:00
2e6eeebdfc feat: add psd color depth == 16 format support 2020-10-30 21:47:12 +08:00
db0b5d571a GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2020-10-11 11:27:17 +02:00
da2fc84a3b GIT_SILENT Upgrade ECM and KF5 version requirements for 5.75.0 release. 2020-10-04 09:52:48 +00:00
d6b79d16ad GIT_SILENT Upgrade ECM and KF5 version requirements for 5.74.0 release. 2020-09-06 09:21:38 +00:00
fc9a128f47 Remove obsolete COPYING files 2020-08-17 08:00:58 +02:00
d326d5dab9 GIT_SILENT increase KF_DISABLE_DEPRECATED_BEFORE_AND_AT 2020-08-16 01:12:16 +02:00
1106 changed files with 93637 additions and 3026 deletions

3
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,3 @@
#clang-format/tidy
1169859b07f25c865ee0bfc2a7dc97a431651776
eaca33bec8b19498c3621fc3a20a8c55a2812462

15
.gitattributes vendored Normal file
View File

@ -0,0 +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

6
.gitignore vendored
View File

@ -20,3 +20,9 @@ random_seed
CMakeLists.txt.user* CMakeLists.txt.user*
*.unc-backup* *.unc-backup*
.cmake/ .cmake/
/.clang-format
/compile_commands.json
.clangd
.idea
/cmake-build*
.cache

22
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: CC0-1.0
include:
- project: sysadmin/ci-utilities
file:
- /gitlab-templates/linux-qt6.yml
- /gitlab-templates/linux-qt6-next.yml
- /gitlab-templates/alpine-qt6.yml
- /gitlab-templates/android-qt6.yml
- /gitlab-templates/freebsd-qt6.yml
- /gitlab-templates/windows-qt6.yml
- /gitlab-templates/xml-lint.yml
- /gitlab-templates/yaml-lint.yml
image_json_validate:
stage: validate
image: invent-registry.kde.org/sysadmin/ci-images/suse-qt68:latest
tags:
- Linux
script:
- find src/imageformats/ -name *.json | xargs -I file bash -c "echo file && jq -e '(.Keys | type == \"array\") and (.MimeTypes | type == \"array\") and (.MimeTypes | length) == (.Keys | length)' file"

11
.kde-ci.yml Normal file
View File

@ -0,0 +1,11 @@
Dependencies:
- 'on': ['Linux', 'FreeBSD', 'macOS', 'Windows', 'Android']
'require':
'frameworks/extra-cmake-modules': '@same'
'frameworks/karchive': '@same'
Options:
test-before-installing: True
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
cmake-options: "-DKIMAGEFORMATS_DDS=ON -DKIMAGEFORMATS_JXR=ON -DKIMAGEFORMATS_HEIF=ON"
per-test-timeout: 90

View File

@ -1,29 +1,31 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.16)
project(KImageFormats) set(KF_VERSION "6.15.0") # handled by release scripts
set(KF_DEP_VERSION "6.15.0") # handled by release scripts
set (CMAKE_CXX_STANDARD 14) project(KImageFormats VERSION ${KF_VERSION})
include(FeatureSummary) include(FeatureSummary)
find_package(ECM 5.73.0 NO_MODULE) find_package(ECM 6.15.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)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) set(CMAKE_MODULE_PATH ${KImageFormats_SOURCE_DIR}/cmake/find-modules ${ECM_MODULE_PATH})
include(KDEInstallDirs) include(KDEInstallDirs)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings) include(KDECMakeSettings)
include(KDEGitCommitHooks)
include(ECMDeprecationSettings)
include(CheckIncludeFiles) include(CheckIncludeFiles)
include(FindPkgConfig)
set(REQUIRED_QT_VERSION 5.12.0) set(REQUIRED_QT_VERSION 6.7.0)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
find_package(KF5Archive) find_package(KF6Archive ${KF_DEP_VERSION})
set_package_properties(KF5Archive 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"
) )
@ -32,30 +34,104 @@ set_package_properties(KF5Archive 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(Qt5PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE) find_package(Qt6PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE)
set_package_properties(Qt5PrintSupport PROPERTIES set_package_properties(Qt6PrintSupport PROPERTIES
PURPOSE "Required for the QImage plugin for EPS images" PURPOSE "Required for the QImage plugin for EPS images"
TYPE OPTIONAL TYPE OPTIONAL
) )
if (Qt5PrintSupport_FOUND) if (TARGET Qt6::PrintSupport)
set(BUILD_EPS_PLUGIN TRUE) set(BUILD_EPS_PLUGIN TRUE)
endif() endif()
endif() endif()
find_package(OpenEXR) find_package(OpenEXR 3.0 CONFIG QUIET)
if(NOT OpenEXR_FOUND)
find_package(OpenEXR)
endif()
set_package_properties(OpenEXR PROPERTIES set_package_properties(OpenEXR PROPERTIES
TYPE OPTIONAL TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for OpenEXR images" PURPOSE "Required for the QImage plugin for OpenEXR images"
) )
add_definitions(-DQT_NO_FOREACH)
# 050d00 (5.13) triggers a BIC in qimageiohandler.h, in Qt 5.13, so do not enable that until we can require 5.14 find_package(libavif 0.8.2 CONFIG QUIET)
# https://codereview.qt-project.org/c/qt/qtbase/+/279215 if(NOT libavif_FOUND)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050c00) find_package(libavif 1 CONFIG)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054700) endif()
set_package_properties(libavif PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for AVIF images"
)
option(KIMAGEFORMATS_DDS "Enable plugin for DDS format" ON)
option(KIMAGEFORMATS_HEIF "Enable plugin for HEIF format" OFF)
if(KIMAGEFORMATS_HEIF)
pkg_check_modules(LibHeif IMPORTED_TARGET libheif>=1.10.0)
endif()
add_feature_info(LibHeif LibHeif_FOUND "required for the QImage plugin for HEIF/HEIC images")
option(KIMAGEFORMATS_JXL "Enable plugin for JPEG XL format" ON)
if(KIMAGEFORMATS_JXL)
pkg_check_modules(LibJXL IMPORTED_TARGET libjxl>=0.9.4)
pkg_check_modules(LibJXLThreads IMPORTED_TARGET libjxl_threads>=0.9.4)
pkg_check_modules(LibJXLCMS IMPORTED_TARGET libjxl_cms>=0.9.4)
endif()
add_feature_info(LibJXL LibJXL_FOUND "required for the QImage plugin for JPEG XL images")
option(KIMAGEFORMATS_JP2 "Enable plugin for JPEG 2000 format" ON)
if(KIMAGEFORMATS_JP2)
find_package(OpenJPEG CONFIG)
endif()
add_feature_info(OpenJPEG OpenJPEG_FOUND "required for the QImage plugin for JPEG 2000 images")
find_package(LibRaw 0.20.2)
set_package_properties(LibRaw PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for RAW images"
)
# JXR plugin disabled by default due to security issues
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(
QT 6.9.0
KF 6.13.0
)
add_subdirectory(src) add_subdirectory(src)
if (BUILD_TESTING) if (BUILD_TESTING)
add_subdirectory(autotests) add_subdirectory(autotests)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6ImageFormats")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/KF6ImageFormatsConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF6ImageFormatsConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF6ImageFormatsConfig.cmake"
INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF6ImageFormatsConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF6ImageFormatsConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
include(ECMFeatureSummary)
ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)

View File

@ -1,510 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations
below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it
becomes a de-facto standard. To achieve this, non-free programs must
be allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control
compilation and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least
three years, to give the same user the materials specified in
Subsection 6a, above, for a charge no more than the cost of
performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply, and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License
may add an explicit geographical distribution limitation excluding those
countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms
of the ordinary General Public License).
To apply these terms, attach the following notices to the library.
It is safest to attach them to the start of each source file to most
effectively convey the exclusion of warranty; and each file should
have at least the "copyright" line and a pointer to where the full
notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or
your school, if any, to sign a "copyright disclaimer" for the library,
if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James
Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2025 Xaver Hugl <xaver.hugl@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
@PACKAGE_INIT@
# empty, because this is plugins for Qt instead of a library to link against

View File

@ -0,0 +1,9 @@
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.

11
LICENSES/BSD-3-Clause.txt Normal file
View File

@ -0,0 +1,11 @@
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.

121
LICENSES/CC0-1.0.txt Normal file
View File

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

373
README.md
View File

@ -1,6 +1,7 @@
# KImageFormats # KImageFormats
Plugins to allow QImage to support extra file formats. Plugins to allow [`QImage`](https://doc.qt.io/qt-6/qimage.html) to support
extra file formats.
## Introduction ## Introduction
@ -13,36 +14,54 @@ image formats.
The following image formats have read-only support: The following image formats have read-only support:
- Animated Windows cursors (ani)
- Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
- Gimp (xcf) - Gimp (xcf)
- OpenEXR (exr) - Krita (kra)
- Photoshop documents (psd) - OpenRaster (ora)
- Sun Raster (ras) - Pixar raster (pxr)
- 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: The following image formats have read and write support:
- AV1 Image File Format (avif)
- DirectDraw Surface (dds)
- Encapsulated PostScript (eps) - Encapsulated PostScript (eps)
- High Efficiency Image File Format (heif)
- JPEG 2000 (jp2, j2k, jpf)
- JPEG XL (jxl)
- JPEG XR (jxr)
- 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
See the QImageIOPlugin documentation for information on how to write a See the [`QImageIOPlugin`](https://doc.qt.io/qt-6/qimageioplugin.html)
new plugin. documentation for information on how to write a new plugin.
The main difference between this framework and the qimageformats module The main difference between this framework and the image formats of Qt is
of Qt is the license. As such, if you write an imageformat plugin and the license. As such, if you write an image format plugin and you are
you are willing to sign the Qt Project contributor agreement, it may be willing to sign the Qt Project contributor agreement, it may be better to
better to submit the plugin directly to the Qt Project. submit the plugin directly to the Qt Project.
Note that the imageformat plugins provided by this module also provide a To be accepted, contributions must:
desktop file. This is for the benefit of KImageIO in the KDE4 Support - Contain the test images needed to verify that the changes work correctly.
framework. - Pass the tests successfully.
For more info about tests, see also [Autotests README](autotests/README.md).
## Duplicated Plugins ## Duplicated Plugins
### The TGA plugin
The TGA plugin supports more formats than Qt's own TGA plugin; The TGA plugin supports more formats than Qt's own TGA plugin;
specifically, the one provided here supports indexed, greyscale and RLE specifically, the one provided here supports indexed, greyscale and RLE
images (types 1-3 and 9-11), while Qt's plugin only supports type 2 images (types 1-3 and 9-11), while Qt's plugin only supports type 2
@ -53,6 +72,18 @@ licensing. If anyone were willing to write fresh code to improve Qt's
TGA plugin, it would allow the TGA plugin in this framework to be TGA plugin, it would allow the TGA plugin in this framework to be
removed. removed.
### The DDS plugin
The DDS plugin is a fork from Qt 5.6 with bug fixes and improvements.
The plugin was forked because Qt Project no longer supports its DDS plugin.
### The JP2 plugin
The JP2 plugin is based on the popular and wide used OpenJPEG library.
The Qt project has a no longer supported JPEG 2000 plugin based on Jasper.
## License ## License
This framework is licensed under the This framework is licensed under the
@ -61,3 +92,317 @@ 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 DDS, 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 available in formats that include it via
`QImage::setText()` and `QImage::text()`. To ensure consistent metadata
functionality, the following keys have been adopted.
About the image:
- `Altitude`: Floating-point number indicating the GPS altitude in meters
above sea level (e.g. 35.4).
- `Author`: Person who created the image.
- `Comment`: Additional image information in human-readable form, for
example a verbal description of the image.
- `Copyright`: Copyright notice of the person or organization that claims
the copyright to the image.
- `CreationDate`: When the image was created or captured. Date and time in
ISO 8601 format without milliseconds (e.g. 2024-03-23T15:30:43). This value
should be kept unchanged when present.
- `Description`: A string that describes the subject of the image.
- `Direction`: Floating-point number indicating the direction of the image
when it was captured in degrees (e.g. 123.3).
- `DocumentName`: The name of the document from which this image was
scanned.
- `HostComputer`: The computer and/or operating system in use at the time
of image creation.
- `Latitude`: Floating-point number indicating the latitude in degrees
north of the equator (e.g. 27.717).
- `Longitude`: Floating-point number indicating the longitude in degrees
east of Greenwich (e.g. 85.317).
- `ModificationDate`: Last modification date and time in ISO 8601 format
without milliseconds (e.g. 2024-03-23T15:30:43). This value should be
updated every time the image is saved.
- `Owner`: Name of the owner of the image.
- `Software`: Name and version number of the software package(s) used to
create the image.
- `Title`: The title of the image.
About the camera:
- `Manufacturer`: The manufacturer of the recording equipment.
- `Model`: The model name or model number of the recording equipment.
- `SerialNumber`: The serial number of the recording equipment.
About the lens:
- `LensManufacturer`: The manufacturer of the interchangeable lens that was
used.
- `LensModel`: The model name or model number of the lens that was used.
- `LensSerialNumber`: The serial number of the interchangeable lens that was
used.
Complex metadata (requires a parser):
- `XML:org.gimp.xml`: XML metadata generated by GIMP and present only in XCF
files.
- `XML:com.adobe.xmp`: [Extensible Metadata Platform (XMP)](https://developer.adobe.com/xmp/docs/)
is the metadata standard used by Adobe applications and is supported by all
common image formats. **Note that XMP metadata is read and written by
plugins as is.** Since it may contain information present in other metadata
(e.g. `Description`), it is the user's responsibility to ensure consistency
between all metadata and XMP metadata when writing an image.
Supported metadata may vary from one plugin to another. Please note that only
the most common metadata are supported and some plugins may return keys not
listed here.
### EXIF Metadata
[EXIF (Exchangeable Image File Format)](https://en.wikipedia.org/wiki/Exif)
metadata is a standard for embedding information within the image file itself.
Unlike the metadata described above, EXIF metadata is used internally by some
plugins to standardize image handling. For example, the JXL plugin uses them
to **set/get the image resolution and metadata**. They are also needed to
make the image properties appear in the file details of some file managers
(e.g. Dolphin).
When reading, EXIF metadata is converted into simple metadata (e.g.
`Description`) and inserted into the image if and only if it is not already
present.
On writing, the image metadata is converted to EXIF and saved appropriately.
Note that, if not present in the image to be saved, the following metadata
are created automatically:
- `Software`: Created using `applicationName` and `applicationVersion` methods
of [`QCoreApplication`](https://doc.qt.io/qt-6/qcoreapplication.html).
- `CreationDate`: Set to current time and date.
- `ModificationDate`: Set to current time and date.
### ICC profile support
ICC profile support is implemented in all formats that handle them using
[`QColorSpace`](https://doc.qt.io/qt-6/qcolorspace.html). When saving, some
plugins convert the image using color profiles according to format
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
- DDS: n/a
- EXR: 300,000 x 300,000 pixels
- EPS: n/a
- HDR: n/a (large image)
- HEIF: n/a
- JP2: 300,000 x 300,000 pixels, in any case no larger than 2 gigapixels
- 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
- KRA: same size as Qt's PNG plugin
- ORA: same size as Qt's PNG plugin
- 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.
JP2, JXL, JXR, PSD and SCT plugins natively support 4-channel CMYK images when
compiled with Qt 6.8+.
### The DDS plugin
**This plugin can be disabled by setting `KIMAGEFORMATS_DDS` to `OFF`
in your cmake options.**
The following defines can be defined in cmake to modify the behavior of the
plugin:
- `DDS_DISABLE_STRIDE_ALIGNMENT`: disable the stride aligment based on DDS
pitch: it is known that some writers do not set it correctly.
### The HEIF plugin
**This plugin is disabled by default. It can be enabled by settings
`KIMAGEFORMATS_HEIF` to `ON` in your cmake options.**
The plugin is disabled due to issues with the heif library on certain
distributions. In particular, it is necessary that the HEIF library has
support for HEVC codec. If HEVC codec is not available the plugin
will compile but will fail the tests.
### 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 EPS plugin
The plugin uses `Ghostscript` to convert the raster image. When reading it
converts the EPS to PPM and uses the Qt PPM plugin to read the image.
When writing it uses [`QPrinter`](https://doc.qt.io/qt-6/qprinter.html) to
create a temporary PDF file which is then converted to EPS. Therefore, if
`Ghostscript` is not installed, the plugin will not work.
### 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 JP2 plugin
**This plugin can be disabled by setting `KIMAGEFORMATS_JP2` to `OFF`
in your cmake options.**
JP2 plugin has the following limitations due to the lack of support by OpenJPEG:
- Metadata are not supported.
- Image resolution is not supported.
- To write ICC profiles you need OpenJPEG V2.5.4 or higher
### 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 by settings
`KIMAGEFORMATS_JXR` to `ON` in your cmake options.**
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 KRA plugin
The KRA format is a ZIP archive containing image data. In particular, the
rendered image in PNG format is saved in the root: the plugin reads this
image.
### The ORA plugin
The ORA format is a ZIP archive containing image data. In particular, the
rendered image in PNG format is saved in the root: the plugin reads this
image.
### 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 CMYK if they have 2 or more channels.
- Multichannel images are treated as Grayscale if they have 1 channel.
- 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.

View File

@ -1,7 +1,4 @@
#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)
@ -14,39 +11,63 @@ 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 Qt5::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")
ecm_mark_as_test(readtest) ecm_mark_as_test(readtest)
endif() endif()
foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS}) foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS})
string(REGEX MATCH "-skipoptional" _is_skip_optional "${_testname}")
unset(skip_optional_arg)
if (_is_skip_optional)
set(skip_optional_arg "--skip-optional-tests")
string(REGEX REPLACE "-skipoptional$" "" _testname "${_testname}")
endif()
add_test( add_test(
NAME kimageformats-read-${_testname} NAME kimageformats-read-${_testname}
COMMAND readtest ${_fuzzarg} ${_testname} COMMAND readtest ${skip_optional_arg} ${_fuzzarg} ${_testname}
) )
endforeach(_testname) endforeach(_testname)
endmacro() endmacro()
macro(kimageformats_write_tests) macro(kimageformats_write_tests)
cmake_parse_arguments(KIF_RT "" "FUZZ" "" ${ARGN})
set(_fuzzarg)
if (KIF_RT_FUZZ)
set(_fuzzarg -f ${KIF_RT_FUZZ})
endif()
if (NOT TARGET writetest) if (NOT TARGET writetest)
add_executable(writetest writetest.cpp) add_executable(writetest writetest.cpp)
target_link_libraries(writetest Qt5::Gui) target_link_libraries(writetest Qt6::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)
endif() endif()
foreach(_testname ${ARGN}) foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS})
string(REGEX MATCH "-lossless$" _is_lossless "${_testname}") string(REGEX MATCH "-lossless$" _is_lossless "${_testname}")
string(REGEX MATCH "-nodatacheck" _is_no_data_check "${_testname}")
string(REGEX MATCH "-skipoptional" _is_skip_optional "${_testname}")
unset(skip_optional_arg)
unset(lossless_arg) unset(lossless_arg)
unset(no_data_check_arg)
if (_is_lossless) if (_is_lossless)
set(lossless_arg "--lossless") set(lossless_arg "--lossless")
string(REGEX REPLACE "-lossless$" "" _testname "${_testname}") string(REGEX REPLACE "-lossless$" "" _testname "${_testname}")
endif() endif()
if (_is_no_data_check)
set(no_data_check_arg "--no-data-check")
string(REGEX REPLACE "-nodatacheck$" "" _testname "${_testname}")
endif()
if (_is_skip_optional)
set(skip_optional_arg "--skip-optional-tests")
string(REGEX REPLACE "-skipoptional$" "" _testname "${_testname}")
endif()
add_test( add_test(
NAME kimageformats-write-${_testname} NAME kimageformats-write-${_testname}
COMMAND writetest ${lossless_arg} ${_testname} COMMAND writetest ${lossless_arg} ${no_data_check_arg} ${skip_optional_arg} ${_fuzzarg} ${_testname}
) )
endforeach(_testname) endforeach(_testname)
endmacro() endmacro()
@ -57,22 +78,102 @@ endmacro()
kimageformats_read_tests( kimageformats_read_tests(
hdr hdr
pcx pcx
pfm
psd psd
pxr
qoi
ras ras
rgb rgb
sct
tga tga
) )
if (KF5Archive_FOUND) if(KIMAGEFORMATS_DDS)
kimageformats_read_tests(dds)
kimageformats_write_tests(dds-nodatacheck-lossless)
endif()
if (KF6Archive_FOUND)
kimageformats_read_tests( kimageformats_read_tests(
kra kra
ora ora
) )
endif() endif()
# Allow some fuzziness when reading this formats, to allow for if (TARGET avif)
# rounding errors (eg: in alpha blending). kimageformats_read_tests(
kimageformats_read_tests(FUZZ 1 avif
)
kimageformats_write_tests(
avif-nodatacheck-lossless
)
endif()
if (LibHeif_FOUND)
kimageformats_read_tests(
heif
)
# because the plug-ins use RGB->YUV conversion which sometimes results in 1 value difference.
kimageformats_write_tests(FUZZ 1
heif-nodatacheck-lossless
)
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.17.0")
kimageformats_read_tests(FUZZ 1
hej2
)
kimageformats_write_tests(FUZZ 1
hej2-nodatacheck-lossless
)
endif()
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.19.6")
kimageformats_read_tests(FUZZ 4
avci
)
endif()
endif()
if (OpenJPEG_FOUND)
kimageformats_read_tests(
jp2
)
# CMYK writing is incorrect in versions before 2.5.3
if ("${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}" VERSION_GREATER_EQUAL "2.5.3")
kimageformats_write_tests(
jp2-nodatacheck-lossless
)
endif()
endif()
if (LibJXL_FOUND AND LibJXLThreads_FOUND)
if(LibJXL_VERSION VERSION_GREATER_EQUAL "0.11.0")
kimageformats_read_tests(
jxl
)
kimageformats_write_tests(
jxl-nodatacheck-lossless
)
else()
kimageformats_read_tests(
jxl-skipoptional
)
kimageformats_write_tests(
jxl-skipoptional-nodatacheck-lossless
)
endif()
endif()
if (LibJXR_FOUND)
kimageformats_read_tests(
jxr
)
kimageformats_write_tests(
jxr-nodatacheck
)
endif()
kimageformats_read_tests(
xcf xcf
) )
@ -83,8 +184,9 @@ kimageformats_read_tests(FUZZ 1
# You can append -lossless to the format to indicate that # You can append -lossless to the format to indicate that
# reading back the image data will result in an identical image. # reading back the image data will result in an identical image.
kimageformats_write_tests( kimageformats_write_tests(
pcx-lossless pcx-nodatacheck
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
) )
@ -96,17 +198,35 @@ kimageformats_write_tests(
# kimageformats_write_tests(eps) # kimageformats_write_tests(eps)
#endif() #endif()
if (OpenEXR_FOUND) if (OpenEXR_FOUND)
# FIXME: OpenEXR tests kimageformats_read_tests(
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 6
exr-nodatacheck-lossless
)
endif() endif()
find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG QUIET) if (LibRaw_FOUND)
kimageformats_read_tests(
raw
)
endif()
if(NOT Qt5Test_FOUND) find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
message(STATUS "Qt5Test not found, some autotests will not be built.")
if(NOT TARGET Qt6::Test)
message(STATUS "Qt6Test 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 Qt5::Gui Qt5::Test) target_link_libraries(pictest Qt6::Gui Qt6::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)
target_link_libraries(anitest Qt6::Gui Qt6::Test)
ecm_mark_as_test(anitest)
add_test(NAME kimageformats-ani COMMAND anitest)

253
autotests/README.md Normal file
View File

@ -0,0 +1,253 @@
# Autotests
Automated testing for plugins to allow
[`QImage`](https://doc.qt.io/qt-6/qimage.html) to support
extra file formats.
## Introduction
The testing part is essential for the correct functioning of the plugins.
There are generic read/write tests and specific tests for the plugins that
require them.
## Read tests
The generic reading tests are contained in the `read` folder. Inside the
`read` folder, there are one or more folders for each plugin to be tested.
A plugin can support multiple image file types, and if you need different
parameters for each type, you need to create a folder for each type supported
by the plugin (see e.g. HEIF plugin). If all formats supported by the plugin
do not require different parameters, a single folder approach is simpler (see
e.g. PSD plugin).
The reading tests are mainly based on comparing the image read by the plugin
with a template in a known and working format. For this reason, the template
formats chosen are those distributed by the Qt project: PNG in the first
instance and TIFF for image formats not supported by PNG (e.g. CMYK images).
Some image options such as `QImageIOHandler::Size`,
`QImageIOHandler::ImageFormat` and `QImageIOHandler::ImageTransformation` are
also checked. If supported by the plugin, the resulting image is checked to
see if it is compatible with the option's specification.
Optionally, for each image, you can also create a JSON file to modify the test
behavior and/or verify data other than image pixels, such as metadata.
Finally, two tests are run for each test case:
- On a random access device: this test must not fail.
- On a sequential access device: a plugin may not support sequential operation.
In this case, the test is skipped. However, if an image is returned, the test
must succeed.
### The readtest command
To start a test, run the `readtest` command with the format to test as an
argument. The format is one of those supported by plugins and a folder with
the name of the format must be present inside the `read` folder.
Depending on the format, you can specify the following additional options.
- `--help`: Displays help on commandline options.
- `--fuzz <max>`: The fuzziness. Used to add some deviation in ARGB data
(nornally used on lossy codec).
- `--perceptive-fuzz`: Used to scale dynamically the fuzziness based on
the alpha channel value. This is useful on images with pre-multiplied and
small alphas. Qt can use different roundings based on optimizations resulting
in very different RGB values. Since the alpha is small visually there is no
difference (so it is not considered an error).
- `--skip-optional-tests`: Used to skip the optional test such as metadata
and resolution tests.
Note that some tests may fail if the correct options are not used. The correct
options for each test are defined in [CMakeLists.txt](CMakeLists.txt).
See also [Add a test to CMakeLists.txt](#add-a-test-to-cmakeliststxt).
### Test image nomenclature
Each test consists of the image to test, the verification image(s) (template)
and, optionally, the additional JSON file.
To be a test, the names of these files must be the same (except for
the extension). A test for a JXL image would be, for example, composed like
this:
- `testRGB.jxl`: The image to test.
- `testRGB.jxl.json`: The test behavior modifier (note that it must contain
the double extension).
- `testRGB.png`: How the image should look (template). The template name
can be different if specified in the JSON file.
Although there is no precise rule for the name of a test, it is good to have
a name that is explanatory.
### JSON behavior file
The behavior file was initially introduced to solve compatibility issues
between different versions of Qt supported by the framework. It was later
extended to also check image metadata.
The JSON file consists of an array of JSON objects. The objects in the array
are iterated sequentially and the first object that matches the requirements
is used for testing (successes are ignored).
Supported values for JSON objects:
- `comment`: Type string. A string shown by the test when a condition occurs.
- `description`: Type string. A description of the object. Not used by the
test.
- `disableAutoTransform`: Type boolean. By default, tests are run with
autotransform enabled (i.e. rotation is applied if the plugin supports it).
Set to `true` to disable autotransform.
- `filename`: Type string. Name of the template file to use. E.g.
"testRGB_Qt_6_2.png".
- `fuzziness`: Type integer. Set the fuzziness only if not already set on the
command line. The value set on the command line wins over the one in the JSON
file.
- `maxQtVersion`: Type string. Maximum Qt version this object is compatible
with (if not set means all). E.g. "6.2.99".
- `metadata`: Type Array. An array of key/value objects (string type)
containing the image metadata as returned by `QImage::text`.
- `minQtVersion`: Type string. Minimum Qt version this object is compatible
with (if not set means all). E.g. "6.2.0".
- `perceptiveFuzziness` Type boolean. Set the perceptive fuzziness only if not
already set on the command line. The value set on the command line wins over
the one in the JSON file.
- `resolution`: Type object. An object with the `dotsPerMeterX` and
`dotsPerMeterY` (integer) values of the image.
- `seeAlso`: Type string. More info about the object. Normally used to point
to bug reports. Not used by the test.
- `unsupportedFormat`: Type `boolean`. When true, the test is skipped.
Some examples:
- Example 1: [Runs only on Qt without alpha bug on float formats](read/jxl/testcard_rgba_fp16.jxl.json)
- Example 2: [Rotation disabled](read/jxl/orientation6_notranfs.jxl.json)
- Example 3: [Metadata](read/psd/metadata.psd.json)
- Example 4: [Check Qt version, resolution and metadata](read/psd/mch-16bits.psd.json)
- Example 5: [Fuzziness setting](read/xcf/birthday16.xcf.json)
These are just a few examples. More examples can be found in the test folders.
## Write tests
The generic writing tests are contained in the `write/basic` and
`write/format` folders. Similar to the read tests, they verify the written
(and then reread) image with a template.
The write test is composed of several phases:
- Basic test: Uses the `write/basic` folder and checks the most common images
and, optionally, metadata and resolution via a JSON properties file.
- Format test: Uses the `write/format` folder and checks that all QImage image
formats are written correctly.
- Dimensional test: Uses the `write/format` folder and check images of
different sizes (odd numbers, prime numbers, etc.) to verify internal
alignments.
- Null device test: Verify that there are no crashes if the device is null.
### The writetest command
To start a test, run the `writetest` command with the format to test as an
argument. The format is one of those supported by plugins, a folder with
the name of the format must be present inside the `write/format` folder and
may need a template image in `write/basic`.
Depending on the format, you can specify the following additional options.
- `--help`: Displays help on commandline options.
- `--create-format-templates`: Create template images for all formats
supported by the QImage in `write/format`. Command to simplify the creation of
format test images when adding a new plugin or modifying an old one. This
command is not intended to be used from the CMakeLists file as it must be used
manually and the generated images must be verified one by one.
- `--fuzz <max>`: The fuzziness. Used to add some deviation in ARGB data
(nornally used on lossy codec).
- `--lossless`: Check that reading back the data gives the same image.
- `--no-data-check`: Don't check that write data is exactly the same.
- `--skip-optional-tests`: Skip optional data tests (metadata, resolution,
etc...).
Note that some tests may fail if the correct options are not used. The correct
options for each test are defined in [CMakeLists.txt](CMakeLists.txt).
See also [Add a test to CMakeLists.txt](#add-a-test-to-cmakeliststxt).
### JSON properties file
The properties file must be located in `write/basic` and must have the name
of the file format (e.g. jxl.json). It is a JSON object composed of the
following values:
- `format`: Type string. The format tested.
- `metadata`: Type Array. An array of key/value objects (string type)
containing the image metadata as returned by `QImage::text`.
- `resolution`: Type object. An object with the `dotsPerMeterX` and `
dotsPerMeterY` (integer) values of the image.
[This is an example](write/basic/jxl.json) of property file.
## Custom tests
If the generic read/write tests do not meet the requirements of a plugin,
it is possible to write a custom test.
In general it makes sense to write a dedicated test for a format if and
only if you are testing unique features not present in other plugins.
### The PIC test
The PIC test is generated using Qt Test class. For more information
see [Qt Test](https://doc.qt.io/qt-6/qttest-index.html).
### The ANI test
The ANI test is generated using Qt Test class. For more information
see [Qt Test](https://doc.qt.io/qt-6/qttest-index.html).
## Add a test to CMakeLists.txt
To add a test to CMake use the `kimageformats_read_tests` and
`kimageformats_write_tests` functions. For example, to add the read
tests for the PSD you just write `kimageformats_read_tests(psd)`.
It is also possible to pass command line arguments to the test by
appropriately composing the string passed to the test functions.
For boolean parameters you need to add a string starting with '-'
after the image format. For example, to pass `--skip-optional-tests`
to the PSD plugin write `kimageformats_read_tests(psd-skipoptional)`.
To add a fuzziness of 4, you must first set it as follows:
`kimageformats_read_tests(FUZZ 4 psd-skipoptional)`.
The possible modifiers for `kimageformats_read_tests` are as follows:
- `-skipoptional`: Add the `--skip-optional-tests` command line parameter.
The possible modifiers for `kimageformats_write_tests` are as follows:
- `-lossless`: Add the `--lossless` command line parameter.
- `-nodatacheck`: Add the `--no-data-check` command line parameter.
- `-skipoptional`: Add the `--skip-optional-tests` command line parameter.
To set multiple parameters, you can enter multiple modifiers. For example:
```
kimageformats_write_tests(FUZZ 1
hej2-nodatacheck-lossless
)
```
## OSS-Fuzz
Plugins are also tested with [OSS-Fuzz](https://google.github.io/oss-fuzz/)
project to identify possible security issues. When adding a new plugin it is
also necessary to add it to the test in the [kimageformats
project](https://github.com/google/oss-fuzz/tree/master/projects/kimageformats)
on OSS-Fuzz.
## TODO
List of tests not implemented or only partially implemented.
### Color Profiles Test
Many plugins support color profiles via [`QColorSpace`](https://doc.qt.io/qt-6/qcolorspace.html).
Checking for correct color management is increasingly necessary especially now
that monitors are HDR and other than RGB color spaces have been added to Qt.
Furthermore, lossy plugins often have different color management behaviors
depending on how the image is saved.
### Animations Test
Few plugins support animations. There are currently no plans for
implementation.

BIN
autotests/ani/test.ani Normal file

Binary file not shown.

BIN
autotests/ani/test_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

BIN
autotests/ani/test_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

BIN
autotests/ani/test_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

119
autotests/anitest.cpp Normal file
View File

@ -0,0 +1,119 @@
/*
SPDX-FileCopyrightText: 2020 Kai Uwe Broulik <kde@broulik.de>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include <QImage>
#include <QImageReader>
#include <QTest>
static bool imgEquals(const QImage &im1, const QImage &im2)
{
const int height = im1.height();
const int width = im1.width();
for (int i = 0; i < height; ++i) {
const auto *line1 = reinterpret_cast<const quint8 *>(im1.scanLine(i));
const auto *line2 = reinterpret_cast<const quint8 *>(im2.scanLine(i));
for (int j = 0; j < width; ++j) {
if (line1[j] - line2[j] != 0) {
return false;
}
}
}
return true;
}
class AniTests : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase()
{
QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR));
}
void testReadMetadata()
{
QImageReader reader(QFINDTESTDATA("ani/test.ani"));
QVERIFY(reader.canRead());
QCOMPARE(reader.imageCount(), 4);
QCOMPARE(reader.size(), QSize(32, 32));
QCOMPARE(reader.text(QStringLiteral("Title")), QStringLiteral("ANI Test"));
QCOMPARE(reader.text(QStringLiteral("Author")), QStringLiteral("KDE Community"));
}
void textRead()
{
QImageReader reader(QFINDTESTDATA("ani/test.ani"));
QVERIFY(reader.canRead());
QCOMPARE(reader.currentImageNumber(), 0);
QImage aniFrame;
QVERIFY(reader.read(&aniFrame));
QImage img1(QFINDTESTDATA("ani/test_1.png"));
img1.convertTo(aniFrame.format());
QVERIFY(imgEquals(aniFrame, img1));
QCOMPARE(reader.nextImageDelay(), 166); // 10 "jiffies"
QVERIFY(reader.canRead());
// that read() above should have advanced us to the next frame
QCOMPARE(reader.currentImageNumber(), 1);
QVERIFY(reader.read(&aniFrame));
QImage img2(QFINDTESTDATA("ani/test_2.png"));
img2.convertTo(aniFrame.format());
QVERIFY(imgEquals(aniFrame, img2));
// The "middle" frame has a longer delay than the others
QCOMPARE(reader.nextImageDelay(), 333); // 20 "jiffies"
QVERIFY(reader.canRead());
QCOMPARE(reader.currentImageNumber(), 2);
QVERIFY(reader.read(&aniFrame));
QImage img3(QFINDTESTDATA("ani/test_3.png"));
img3.convertTo(aniFrame.format());
QVERIFY(imgEquals(aniFrame, img3));
QCOMPARE(reader.nextImageDelay(), 166);
QVERIFY(reader.canRead());
QCOMPARE(reader.currentImageNumber(), 3);
QVERIFY(reader.read(&aniFrame));
// custom sequence in the ANI file should get us back to img2
QVERIFY(imgEquals(aniFrame, img2));
QCOMPARE(reader.nextImageDelay(), 166);
// We should have reached the end now
QVERIFY(!reader.canRead());
QVERIFY(!reader.read(&aniFrame));
// Jump back to the start
QVERIFY(reader.jumpToImage(0));
QVERIFY(reader.canRead());
QCOMPARE(reader.currentImageNumber(), 0);
QCOMPARE(reader.nextImageDelay(), 166);
QVERIFY(reader.read(&aniFrame));
QVERIFY(imgEquals(aniFrame, img1));
}
};
QTEST_MAIN(AniTests)
#include "anitest.moc"

69
autotests/fuzzyeq.cpp Normal file
View File

@ -0,0 +1,69 @@
/*
SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kdemail.net>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include <QImage>
#include <QRgb>
#include <QRgba64>
inline int iAbs(const int &v)
{
return v < 0 ? -v : v;
}
template<class Trait>
static bool fuzzyeq(const QImage &im1, const QImage &im2, int fuzziness, bool perceptiveFuzzer)
{
Q_ASSERT(im1.format() == im2.format());
Q_ASSERT(im1.depth() == 24 || im1.depth() == 32 || im1.depth() == 64);
const bool hasAlpha = im1.hasAlphaChannel();
const int height = im1.height();
const int width = im1.width();
for (int i = 0; i < height; ++i) {
const Trait *line1 = reinterpret_cast<const Trait *>(im1.scanLine(i));
const Trait *line2 = reinterpret_cast<const Trait *>(im2.scanLine(i));
for (int j = 0; j < width; ++j) {
auto &&px1 = line1[j];
auto &&px2 = line2[j];
auto fuzz = int(fuzziness);
// Calculate the deltas
auto dr = iAbs(int(qRed(px2)) - int(qRed(px1)));
auto dg = iAbs(int(qGreen(px2)) - int(qGreen(px1)));
auto db = iAbs(int(qBlue(px2)) - int(qBlue(px1)));
auto da = iAbs(int(qAlpha(px2)) - int(qAlpha(px1)));
// Always compare alpha even on images without it: some formats (e.g. RGBX64),
// want it set to a certain value (e.g. 65535).
if (da > fuzz)
return false;
// Calculate the perceptive fuzziness.
if (hasAlpha && perceptiveFuzzer) {
auto alpha = std::max(4, int(qAlpha(px1)));
if (sizeof(Trait) == 4)
fuzz = std::min(fuzz * (255 / alpha), 255);
else
fuzz = std::min(fuzz * (65535 / alpha), 255 * 257);
}
// Compare the deltas of R, G, B components.
if (dr > fuzz)
return false;
if (dg > fuzz)
return false;
if (db > fuzz)
return false;
}
}
return true;
}
// allow each byte to be different by up to 1, to allow for rounding errors
static bool fuzzyeq(const QImage &im1, const QImage &im2, uchar fuzziness, bool perceptiveFuzzer = false)
{
return (im1.depth() == 64) ? fuzzyeq<QRgba64>(im1, im2, int(fuzziness) * 257, perceptiveFuzzer) : fuzzyeq<QRgb>(im1, im2, int(fuzziness), perceptiveFuzzer);
}

View File

@ -35,61 +35,27 @@ private:
QTest::addColumn<QImage::Format>("pngformat"); QTest::addColumn<QImage::Format>("pngformat");
QTest::addColumn<bool>("compress"); QTest::addColumn<bool>("compress");
QTest::newRow("4x4 no alpha RLE") QTest::newRow("4x4 no alpha RLE") << QFINDTESTDATA("pic/4x4-simple-color.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString() << false
<< QFINDTESTDATA("pic/4x4-simple-color.pic") << QImage::Format_RGB32 << true;
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QString()
<< false
<< QImage::Format_RGB32
<< true;
QTest::newRow("4x4 no alpha raw") QTest::newRow("4x4 no alpha raw") << QFINDTESTDATA("pic/4x4-simple-color-uncompressed.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString()
<< QFINDTESTDATA("pic/4x4-simple-color-uncompressed.pic") << false << QImage::Format_RGB32 << false;
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QString()
<< false
<< QImage::Format_RGB32
<< false;
QTest::newRow("Short comment") QTest::newRow("Short comment") << QFINDTESTDATA("pic/short-comment.pic") << QFINDTESTDATA("pic/4x4-simple-color.png")
<< QFINDTESTDATA("pic/short-comment.pic") << QStringLiteral("Test comment value") << false << QImage::Format_RGB32 << true;
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QStringLiteral("Test comment value")
<< false
<< QImage::Format_RGB32
<< true;
QTest::newRow("Long comment") QTest::newRow("Long comment") << QFINDTESTDATA("pic/long-comment.pic") << QFINDTESTDATA("pic/4x4-simple-color.png")
<< QFINDTESTDATA("pic/long-comment.pic") << QStringLiteral("Test comment value that goes right up to the end of the comment field and has no") << false
<< QFINDTESTDATA("pic/4x4-simple-color.png") << QImage::Format_RGB32 << true;
<< QStringLiteral("Test comment value that goes right up to the end of the comment field and has no")
<< false
<< QImage::Format_RGB32
<< true;
QTest::newRow("Long run-lengths") QTest::newRow("Long run-lengths") << QFINDTESTDATA("pic/long-runs.pic") << QFINDTESTDATA("pic/long-runs.png") << QString() << false
<< QFINDTESTDATA("pic/long-runs.pic") << QImage::Format_RGB32 << true;
<< QFINDTESTDATA("pic/long-runs.png")
<< QString()
<< false
<< QImage::Format_RGB32
<< true;
QTest::newRow("4x4 with alpha RLE") QTest::newRow("4x4 with alpha RLE") << QFINDTESTDATA("pic/4x4-alpha.pic") << QFINDTESTDATA("pic/4x4-alpha.png") << QString() << true
<< QFINDTESTDATA("pic/4x4-alpha.pic") << QImage::Format_ARGB32 << true;
<< QFINDTESTDATA("pic/4x4-alpha.png")
<< QString()
<< true
<< QImage::Format_ARGB32
<< true;
QTest::newRow("4x4 with alpha raw") QTest::newRow("4x4 with alpha raw") << QFINDTESTDATA("pic/4x4-alpha-uncompressed.pic") << QFINDTESTDATA("pic/4x4-alpha.png") << QString() << true
<< QFINDTESTDATA("pic/4x4-alpha-uncompressed.pic") << QImage::Format_ARGB32 << false;
<< QFINDTESTDATA("pic/4x4-alpha.png")
<< QString()
<< true
<< QImage::Format_ARGB32
<< false;
} }
private Q_SLOTS: private Q_SLOTS:
@ -106,13 +72,8 @@ private Q_SLOTS:
// so there is no actual data loss in converting to RGB16. // so there is no actual data loss in converting to RGB16.
// This just tests that the pic plugin can deal with different // This just tests that the pic plugin can deal with different
// input formats. // input formats.
QTest::newRow("altered format") QTest::newRow("altered format") << QFINDTESTDATA("pic/4x4-simple-color.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString() << false
<< QFINDTESTDATA("pic/4x4-simple-color.pic") << QImage::Format_RGB16 << true;
<< QFINDTESTDATA("pic/4x4-simple-color.png")
<< QString()
<< false
<< QImage::Format_RGB16
<< true;
} }
void testRead_data() void testRead_data()
@ -148,17 +109,12 @@ private Q_SLOTS:
imgWriter.write(pngImage); imgWriter.write(pngImage);
if (expData != picData) { if (expData != picData) {
QString fileNameBase = QUuid::createUuid().toString() QString fileNameBase = QUuid::createUuid().toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
.remove(QLatin1Char('{'))
.remove(QLatin1Char('}'));
QFile dumpFile(fileNameBase + QStringLiteral(".pic")); QFile dumpFile(fileNameBase + QStringLiteral(".pic"));
QVERIFY2(dumpFile.open(QIODevice::WriteOnly), qPrintable(dumpFile.errorString())); QVERIFY2(dumpFile.open(QIODevice::WriteOnly), qPrintable(dumpFile.errorString()));
dumpFile.write(picData); dumpFile.write(picData);
QString msg = QStringLiteral("Written data (") QString msg =
+ dumpFile.fileName() QStringLiteral("Written data (") + dumpFile.fileName() + QStringLiteral(") differed from expected data (") + picfile + QLatin1Char(')');
+ QStringLiteral(") differed from expected data (")
+ picfile
+ QLatin1Char(')');
QFAIL(qPrintable(msg)); QFAIL(qPrintable(msg));
} }
} }
@ -182,29 +138,20 @@ private Q_SLOTS:
QCOMPARE(inputImage.width(), expImage.width()); QCOMPARE(inputImage.width(), expImage.width());
QCOMPARE(inputImage.height(), expImage.height()); QCOMPARE(inputImage.height(), expImage.height());
QCOMPARE(inputImage.hasAlphaChannel(), alpha); QCOMPARE(inputImage.hasAlphaChannel(), alpha);
QCOMPARE(inputImage.format(), alpha ? QImage::Format_ARGB32 QCOMPARE(inputImage.format(), alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
: QImage::Format_RGB32);
expImage = expImage.convertToFormat(pngformat); expImage = expImage.convertToFormat(pngformat);
expImage = expImage.convertToFormat(alpha ? QImage::Format_ARGB32 expImage = expImage.convertToFormat(alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
: QImage::Format_RGB32);
if (inputImage != expImage) { if (inputImage != expImage) {
QString fileNameBase = QUuid::createUuid().toString() QString fileNameBase = QUuid::createUuid().toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
.remove(QLatin1Char('{'))
.remove(QLatin1Char('}'));
QFile picDumpFile(fileNameBase + QStringLiteral("-expected.data")); QFile picDumpFile(fileNameBase + QStringLiteral("-expected.data"));
QVERIFY2(picDumpFile.open(QIODevice::WriteOnly), qPrintable(picDumpFile.errorString())); QVERIFY2(picDumpFile.open(QIODevice::WriteOnly), qPrintable(picDumpFile.errorString()));
picDumpFile.write(reinterpret_cast<const char *>(inputImage.bits()), picDumpFile.write(reinterpret_cast<const char *>(inputImage.bits()), inputImage.sizeInBytes());
inputImage.sizeInBytes());
QFile pngDumpFile(fileNameBase + QStringLiteral("-actual.data")); QFile pngDumpFile(fileNameBase + QStringLiteral("-actual.data"));
QVERIFY2(pngDumpFile.open(QIODevice::WriteOnly), qPrintable(pngDumpFile.errorString())); QVERIFY2(pngDumpFile.open(QIODevice::WriteOnly), qPrintable(pngDumpFile.errorString()));
pngDumpFile.write(reinterpret_cast<const char *>(expImage.bits()), pngDumpFile.write(reinterpret_cast<const char *>(expImage.bits()), expImage.sizeInBytes());
expImage.sizeInBytes()); QString msg = QStringLiteral("Read image (") + picDumpFile.fileName() + QStringLiteral(") differed from expected image (") + pngDumpFile.fileName()
QString msg = QStringLiteral("Read image (") + QLatin1Char(')');
+ picDumpFile.fileName()
+ QStringLiteral(") differed from expected image (")
+ pngDumpFile.fileName()
+ QLatin1Char(')');
QFAIL(qPrintable(msg)); QFAIL(qPrintable(msg));
} }
} }
@ -252,8 +199,7 @@ private Q_SLOTS:
QImageReader inputReader(picfile, "pic"); QImageReader inputReader(picfile, "pic");
QCOMPARE(inputReader.imageFormat(), QCOMPARE(inputReader.imageFormat(), alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
} }
}; };

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

BIN
autotests/read/avif/bw.avif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

View File

Before

Width:  |  Height:  |  Size: 743 B

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

View File

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,59 @@
[
{
"fileName" : "metadata.png",
"metadata" : [
{
"key" : "ModificationDate",
"value" : "2025-02-19T08:27:22+01:00"
},
{
"key" : "Software" ,
"value" : "GIMP 3.0.0-RC3"
},
{
"key" : "Altitude",
"value" : "34"
},
{
"key" : "Author",
"value" : "KDE Project"
},
{
"key" : "Copyright",
"value" : "@2025 KDE Project"
},
{
"key" : "Description",
"value" : "TV broadcast test image."
},
{
"key" : "Latitude",
"value" : "44.6478"
},
{
"key" : "LensManufacturer",
"value" : "KDE Glasses"
},
{
"key" : "LensModel",
"value" : "A1234"
},
{
"key" : "Longitude",
"value" : "10.9254"
},
{
"key" : "Manufacturer",
"value" : "KFramework"
},
{
"key" : "Model",
"value" : "KImageFormats"
}
],
"resolution" : {
"dotsPerMeterX" : 11811,
"dotsPerMeterY" : 5905
}
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

View File

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Copyright (c) 2006 - 2010 The Open Toolkit library.
SPDX-License-Identifier: MIT

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
autotests/read/dds/r16.dds Normal file

Binary file not shown.

BIN
autotests/read/dds/r16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
autotests/read/dds/r32.dds Normal file

Binary file not shown.

BIN
autotests/read/dds/r32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
autotests/read/dds/rg16.dds Normal file

Binary file not shown.

BIN
autotests/read/dds/rg16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
autotests/read/dds/rg32.dds Normal file

Binary file not shown.

BIN
autotests/read/dds/rg32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
autotests/read/dds/rgba.dds Normal file

Binary file not shown.

BIN
autotests/read/dds/rgba.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

View File

@ -0,0 +1,7 @@
[
{
"fileName" : "rgba16dx10.png",
"fuzziness" : 1,
"description" : "Minimum fuzziness value to pass the test on all architectures."
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

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