Commit Graph

695 Commits

Author SHA1 Message Date
Mirco Miranda
a33446f86a Use of heif_context_add_XMP_metadata instead
heif_context_add_XMP_metadata2

(cherry picked from commit 245c835d92)
2025-03-11 11:32:12 +01:00
Nicolas Fella
35ab37c628 Update dependency version to 6.12.0 2025-03-07 15:09:18 +01:00
Albert Astals Cid
b28baa4a1e sct: qRound with param bigger than max int is undefined
oss-fuzz/399667098
2025-03-04 06:33:52 +00:00
Albert Astals Cid
5d2540c135 sct: Use height instead of width when calculating dotsPerMeterY 2025-03-04 06:29:58 +00:00
Mirco Miranda
25cc8bc262 MicroExif: search for the TIFF signature 2025-03-03 09:17:56 +01:00
Mirco Miranda
7742537f8c MicroExif: API improvements and minor bugfixes 2025-03-02 13:34:02 +00:00
Mirco Miranda
d3386bbf50 Fix compilation error 2025-03-02 13:49:25 +01:00
Mirco Miranda
e77986c7e0 Added support for resolution and EXIF/XMP metadata to HEIF 2025-03-02 08:03:28 +00:00
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
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
Mirco Miranda
bb1c6aab9e Added pixel limit detected by experimental tests 2025-02-17 08:54:49 +01:00
Daniel Novomeský
74a734efed jxl: fix build with Qt before 6.8.0 2025-02-15 16:16:10 +01:00
Mirco Miranda
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
Daniel Novomeský
36a6ef7d78 heif: improve handling of grayscale ICC profiles 2025-02-10 16:59:49 +00:00
Daniel Novomeský
9fd6896cec Improve printing details when writetest fails 2025-02-10 16:59:49 +00:00
Daniel Novomeský
9b14e752db Update HEIF writetest templates 2025-02-10 16:59:49 +00:00
Laurent Montel
90a2e3b412 GIT_SILENT: it compiles fine without kf6.11 deprecated methods 2025-02-10 06:46:22 +01:00
Mirco Miranda
b28cf4c352 Added JXL to CMYK formats 2025-02-07 15:55:23 +01:00
Nicolas Fella
b536ec4a5e Update version to 6.12.0 2025-02-07 15:38:22 +01:00
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