Commit Graph
135 Commits
Author SHA1 Message Date
Ana BobilloandMirco Miranda 296444189e IFF: set every pixel of each line
Images are allocated without being initialized, so a reader must write
every pixel of every line. The IFF reader did not always:

- Maya: nothing checked that the tiles cover the image: areas no tile
  covers are now opaque black.
- readStandardImage(), readCDIImage(), readRGFXImage() and
  readDEEPImage() copied min(bytesPerLine, decoded line) bytes, and some
  decoded lines are shorter than the image line:
  - a PBM with 8 bitplanes and a 64 color CMAP was taken for HAM and
    allocated as RGB888, while PBM data are one index per pixel: HAM is
    no longer applied to PBM images;
  - other mismatches (e.g. HAM without CMAP, RGB8 with 32 bitplanes, CD-i
    CLUT3 or RGB888, a truncated CD-i line) are now an error: a decoded
    line that does not cover the image line is refused.

Added the read test pbm_64colors.iff, which fails without this change.
2026-10-29 08:27:06 +01:00
Mirco MirandaandMirco Miranda 26d960cb72 DDS: add DX10 BC6H support
Add read support for BC6H textures declared in the DX10 extended
header (DXGI formats BC6H_TYPELESS, BC6H_UF16 and BC6H_SF16).
2026-10-28 07:49:26 +01:00
Ana BobilloandMirco Miranda 5e406e76ba PCX: set every pixel of each line
Images are allocated without being initialized, so a reader must write
every pixel of every line. The PCX reader did not always:

- readImage2() and readImage4v2() decoded width / 4 and width / 2 bytes,
  so the last pixels of lines whose width is not a multiple of 4 (2 bits)
  or 2 (4 bits) were not set. They now decode every pixel.
- With a BytesPerLine smaller than a line of pixels, readImage1(),
  readImage8() and readImage24() left the end of each line unset: such
  headers are now refused by isSupported(), which replaces the check
  readImage4() had.

Added the read tests indexed2_w13.pcx and indexed4_w13.pcx, which fail
without this change.
2026-10-28 07:43:33 +01:00
Ana Bobillo 32ff79442c RAS: unpack 1-bit images with a color map
1-bit images with a color map are loaded as Indexed8, but their lines
were copied packed: the first (width + 7) / 8 bytes (rounded up to an
even number) of each line held packed bits read as indexes, and the rest
of the line was not set, so it kept whatever the memory held (images are
allocated without being initialized). The bits are now unpacked to one
index per pixel.

Added the read test pal1bit.ras, which fails without this change.
2026-10-27 10:39:33 +01:00
Wang ZichongandMirco Miranda e07c5386ff DDS: simply use 0 for blue channel for readATI2()
Originally we uses getNormalZ() for the image, which treat the
image as a normal map. Visual Studio simply fill the blue channel
with 0 instead. Since DDS is for DirectX which is a MS stuff, align
to Visual Studio might be a good idea.

Also, red and green channel should be swapped.
2026-10-27 07:23:35 +01:00
Wang ZichongandMirco Miranda 3b18b654b0 DDS: add DX10 BC4/BC5/BC7 support
DX10 DDS files using the BC (block compression) formats were reported as
unsupported: knownDXGIFormat() only mapped the floating point DXGI
formats, so getFormat() returned FormatUnknown and ensureScanned() failed,
e.g. for a BC7_UNORM_SRGB (dxgi 99) image.

The following changes have been made:

- Added a self-contained BC7 decoder following the "BC7 Format"
  specification, supporting all 8 modes, for both the UNORM and the
  UNORM_SRGB variants (loaded as ARGB32)
- Added BC4 support (single channel, loaded as Grayscale8)
- Added BC5 support, reusing the existing ATI2/3Dc normal map decoder
- Added DX10 mappings for BC1/BC2/BC3, which were previously handled only
  as the legacy DXT1/DXT3/DXT5 fourCC formats
- Added read tests for BC4, BC5, BC7 and BC7_UNORM_SRGB, plus DX10
  variants of the existing BC1/BC2/BC3 test images

BC6H (HDR) is not supported.

The test data was generated from the existing rgba.png test image, encoded
with bc7enc_rdo and decoded with bcdec.

BUG: 524495
2026-10-20 03:38:47 +02:00
Roland BusaandDaniel Novomeský dc714be934 heif: apply all rotation and mirror combinations
read_orientation_helper() mapped the irot/imir properties to an EXIF
orientation with a list of conditions that misses several combinations,
e.g. a 90 degrees counterclockwise rotation followed by a mirroring,
which is how iPhone front-camera photos are stored. For those it still
returned true, so libheif was told to ignore the transformations while
Qt got no orientation either, and the image was shown sideways.

The orientation is now chosen by a switch on the rotation and, in each
case, on the mirroring, which is applied after the rotation as MIAF
requires. Other rotation values are left to libheif.

The new read tests cover the twelve rotation and mirroring combinations,
named like the AVIF ones. All of them display the same picture (colored
corners and an "F"): the stored pixels are that picture with the
transformations undone, written as uncompressed HEIF with libheif. Four
of them fail without this change.
2026-10-14 09:59:31 +00:00
Sertonix NorsonandDaniel Novomeský af34c774d3 avif: increase fuzziness in invalid-exif.avif.json to 44
Fixes kimageformats-read-avif test failure on Alpine Linux s390x

Ref https://invent.kde.org/frameworks/kimageformats/-/merge_requests/530#note_1561068
2026-10-03 23:13:16 +00:00
Mirco MirandaandMirco Miranda 6a3c7f2c86 EXR: support for metadata saved by Photoshop 2026-09-10 07:36:10 +02:00
Daniel Novomeský b7a407a752 autotests: add AVIF image-grid image to read test 2026-09-08 16:43:31 +02:00
Mirco MirandaandMirco Miranda a738553dc9 EXR: fix alpha channel imperpretation 2026-09-04 18:40:44 +02:00
Daniel Novomeský 47ea774621 autotests: Add non-standard HEIF image 2026-08-24 18:49:54 +02:00
Daniel Novomeský 42e9733060 Add HEIC test files with crop transformation 2026-08-20 22:21:48 +02:00
Daniel Novomeský a11c1feb23 autotests: add AVIF and JXL with animation 2026-08-06 13:08:53 +02:00
Mirco Miranda 2e199eea80 KRA/ORA: merged in a single plugin and added metadata support
- ORA/KRA: merged in a single plugin (KRA)
- ORA: removed standalone plugin
- KRA: use of logging category
- KRA: add metadata support by processing the embedded `documentinfo.xml`
- Improved signature lookup (see MR !17) and added test case
2026-07-29 07:42:42 +02:00
Daniel Novomeský 5c3bdcddf2 avif: enable decoding of files with invalid EXIF metadata
When 1st parsing ends with invalid EXIF payload error,
we try 2nd time again while ignoring the EXIF metadata.

Dropped support for legacy 0.x libavif versions,
libavif 1.0.0+ is now required for the AVIF support.
2026-07-27 12:33:25 +00:00
Mirco MirandaandMirco Miranda c21b50d699 EXIF: add support for Windows Explorer tags 2026-07-20 07:27:34 +02:00
Daniel Novomeský 2faf524b85 More HEIF-related tests.
New option `KIMAGEFORMATS_HEIC_TEST` for testing images with
HEVC codec only.

Existing option `KIMAGEFORMATS_HEIF_TEST` is used for testing other
possible (mostly quite rare) codecs that might be used by HEIF
images - uncompressed, deflate, zlib, brotli, jpeg.
2026-07-14 08:36:37 +00:00
Mirco Miranda 7e14d5616f IFF: support for ZIP compressed RGFX 2026-07-13 10:13:23 +02:00
Mirco Miranda 0e2b137b32 IFF: fix byte swapping in 16-bit DEEP images 2026-05-12 10:31:43 +02:00
Mirco Miranda 6d5e61f0b0 Add Farbfeld read only support 2026-05-11 07:38:28 +02:00
Mirco MirandaandMirco Miranda 49a8fd38c8 IFF: DEEP image support 2026-05-08 01:29:54 +02:00
Mirco MirandaandMirco Miranda 8048279473 HEIF: image transformation support 2026-05-03 00:00:11 +02:00
Mirco Miranda 276338199a EXR: fix incorrect loading of EXR files saved by Photoshop 2026 2026-04-16 15:34:33 +02:00
Mirco Miranda 742b5097f6 Fix HOST Computer metadata 2026-04-14 10:47:54 +02:00
Mirco MirandaandMirco Miranda 142ec14c81 TIM: PlayStation graphics read only support 2026-03-24 08:38:08 +01:00
Mirco Miranda e0f1ba640a IFF: add uncompressed RGFX support 2026-01-27 13:58:01 +01:00
Mirco Miranda 99e4223393 IFF: add support for CD-i YUVS chunk (and minor code improvements) 2026-01-15 16:53:50 +01:00
Mirco Miranda 8224c0099d Add support for CD-I IFF images 2026-01-14 16:53:19 +01:00
Daniel Novomeský 8d7fb2c3fd Add JXL testfile which previously triggered crash 2026-01-11 15:25:03 +01:00
Daniel Novomeský abf4d32858 Add gray AVIF files with various transfer functions 2026-01-10 20:41:52 +00:00
Daniel Novomeský 3f1ee9f9d1 Add YCgCo-Re AVIF test
Disable AVIF read tests for libavif below 1.2.0,
where YCgCo-Re decoding is expected to fail.
2025-12-27 21:35:25 +01:00
Mirco Miranda 8061500b79 PSD: add support for GrayA (8/16/32 bit) and Gray 32 bit 2025-11-21 06:24:53 +01:00
Mirco Miranda 146f637385 Fix read test failing on aarch64 2025-10-17 13:43:24 +02:00
Mirco Miranda b83f4c0231 Add color space check during read test 2025-09-27 11:12:50 +02:00
Mirco Miranda a4e18734bd Resolution calculations performed by functions
Added functions for dpi <-> ppm transformations and used in all plugins.
2025-09-17 12:22:44 +02:00
Mirco MirandaandAlbert Astals Cid 463da81fad IFF: support for PCHG chunk
Highlights:
- Adds support for a new palette changer chunk. Some test cases attached to #38 .
- Fixes the reading of ILBMs with the mask (test case: [cyclone.iff](/uploads/d8734d2155fd0d21f7b003b37e0d1259/cyclone.iff)).
- Adds support for HAM5 encoding.
- Adds more test cases created using [HAM Converter](http://mrsebe.bplaced.net/blog/wordpress/).
- Adds support for Atari STE RAST chunk outside FORM one (test case: [fish.iff](/uploads/c461cf4b6a1423cec60fbce645d9fd07/fish.iff)).

NOTE: I contacted Sebastiano Vigna, the author of the PCHG chunk specifications, and he provided me with:
- Some images to test the code (but I can't include them in the test cases).
- Permission to use [his code](https://vigna.di.unimi.it/amiga/PCHGLib.zip) without restrictions: Huffman decompression was achieved by converting `FastDecomp.a` via AI.

Closes #38
2025-09-08 15:39:50 +00:00
Mirco MirandaandAlbert Astals Cid 9c6c0c01ae TGA: Support for TGA specification 2.0
Adds TGA 2.0 compliance:
- Support for Extension Area, Developer Area and Footer (metadata support)
- Support for 15-bit and 16-bit per pixel images (both RGB and Indexed)
- Full support for rotation on reading (we cannot use Qt transformations because only a subset is part of the TGA specification)
- When writing you can choose the supported version (subType)
- Improved writing speed (approximately 10 times) and removed whole image conversions (significant memory savings)

It pass the [TrueVision TGA 2.0 conformance suite](https://github.com/zigimg/test-suite/tree/master/fixtures/tga).

Test changes:
- Read test: added ability to skip a specific test on sequential devices (via JSON behavior file)
- Write test: added the ability to set the subType when writing (via JSON properties file)

Closes #37
2025-08-23 09:20:09 +00:00
Mirco MirandaandAlbert Astals Cid 480ea8dba0 IFF: add support for RGBN/RGB8 image data and CAT chunk
Add the following features:
- RGB8 image data support (test case added)
- RGBN image data support ([Clouds.iff](/uploads/9db869350f74421bf1813fa7d4332f4f/Clouds.iff))
- CAT chunk support: you can have more than one image for file (test case added)
- Image transformation support via EXIF data

[RGBN/RGB8](https://wiki.amigaos.net/wiki/RGBN_and_RGB8_IFF_Image_Data) files are used in Impulse's Turbo Silver and Imagine.

Closes #34
2025-08-07 20:17:09 +00:00
Mirco MirandaandMirco Miranda 37e3c65a05 ILBM 64-bit extension support 2025-08-04 13:47:00 +02:00
Mirco Miranda c2a1d4b401 IFF: Fix halfbride detection, 1-bitplane colors and PBM line size calculation. It also ignore ZBuffer flag on Maya images (like Photoshop does) amd adds CMYK palette support. 2025-08-01 15:29:52 +02:00
Mirco Miranda fd864e6f55 IFF: add support for uncompressed ACBM type 2025-07-24 07:37:58 +02:00
Mirco Miranda 0a9f9fe106 IFF: support for Ham8, HalfBride, Pbm and ILBM 32-bits modes 2025-07-15 07:38:19 +02:00
Mirco MirandaandAlbert Astals Cid 4f2f2425d3 IFF: read only support to Interchange Format Files
Read-only support for most common Interchange Format Files (IFF). Supports IFF saved by Photoshop for the Amiga and Maya platform and HAM6 coded files.

Closes #29
2025-07-01 21:59:03 +00:00
Kai Uwe BroulikandMirco Miranda e6357c22f7 tga: Use Format_Indexed8 for indexed formats and support 32-bit BGRA colormap 2025-06-26 16:00:11 +02:00
Mirco Miranda e77986c7e0 Added support for resolution and EXIF/XMP metadata to HEIF 2025-03-02 08:03:28 +00:00
Mirco MirandaandAlbert Astals Cid 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 MirandaandAlbert Astals Cid 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 MirandaandAlbert Astals Cid 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