Commit Graph

675 Commits

Author SHA1 Message Date
Nicolas Fella
7d7b295ac2 Update dependency version to 6.11.0 2025-02-07 14:47:25 +01:00
Daniel Novomeský
397957a976 jxl: refactor image saving, native CMYK support 2025-02-07 10:38:46 +00:00
Mirco Miranda
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
Daniel Novomeský
7a74b50d64 imageconverter: possibility to set image quality 2025-02-04 14:42:44 +01:00
Daniel Novomeský
0a06a07fa4 Print more details when writetest fails 2025-02-04 10:09:12 +00:00
Mirco Miranda
e89408b426 Fix RAW mime type 2025-01-31 08:32:23 +01:00
Daniel Novomeský
8a05711e99 jxl: refactor image loading 2025-01-29 17:02:51 +00:00
Laurent Montel
d6534f0e68 Add xml/yaml linting 2025-01-29 06:57:55 +01:00
Albert Astals Cid
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
Mirco Miranda
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
Mirco Miranda
424e7a75de Modified PCX mime type according to IANA db 2025-01-23 08:00:37 +01:00
Mirco Miranda
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
Laurent Montel
baaf1093a1 GIT_SILENT: it compiles fine without kf6.10 deprecated methods 2025-01-20 09:53:06 +00:00
Mirco Miranda
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
Mirco Miranda
873ec1bb5f More metadata read tests
Adds some metadata/read resolution tests without adding new images.
2025-01-16 23:03:37 +00:00
Mirco Miranda
287a447095 Fix use of deprecated methods 2025-01-16 14:02:44 +01:00
Mirco Miranda
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
Mirco Miranda
ac3591c7ea PSD: added support to EXIF metadata 2025-01-15 23:26:02 +00:00
Mirco Miranda
a89367dde6 JXR: set max XMP size to 4MiB 2025-01-15 20:36:28 +00:00
Albert Astals Cid
65a587afad CI: Add linux-qt6-next build 2025-01-15 19:16:26 +01:00
Mirco Miranda
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
Mirco Miranda
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
Albert Astals Cid
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
Albert Astals Cid
f296c38daf xcf: Return early if seek fails
BUGS: 498381
2025-01-09 02:33:51 +00:00
Daniel Novomeský
bda8487147 heif: fix -Wstringop-overread warning 2025-01-08 16:45:57 +01:00
Daniel Novomeský
bb10c4bd5c jxl: refactor metadata boxes reading 2025-01-08 12:43:42 +01:00
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Nicolas Fella
40c2aae0cd Update version to 6.11.0 2025-01-03 16:41:05 +01:00
Nicolas Fella
f49704b2df Update dependency version to 6.10.0 2025-01-03 16:15:48 +01:00
Daniel Novomeský
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
Daniel Novomeský
a7cf1a87f9 Update heif.json 2024-12-31 17:33:58 +01:00
Daniel Novomeský
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
b649cca304 DDS: Fix for OSS Fuzz issue 384974505 2024-12-19 07:18:37 +00:00
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Nicolas Fella
a531978e2a Update version to 6.10.0 2024-12-06 16:07:49 +01:00
Nicolas Fella
ceb1c46fea Update dependency version to 6.9.0 2024-12-06 12:41:46 +01:00
Daniel Novomeský
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