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.
- 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):
{width=597 height=259}
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
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.
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:

- PowerPC:

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.
Added support for the following options:
- `ImageTransformation`: uses EXIF data (same behaviour of Photoshop and GIMP)
- `Description`: uses EXIF data
- `ImageFormat`
Closes#17
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.
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
```
- 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.
{width=401 height=357}
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
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
- 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
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.
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)
- 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:
{width=281 height=157}{width=271 height=169}
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)
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
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
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).
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
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`.
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)
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)
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).
- 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.