Compare commits

..
238 Commits
Author SHA1 Message Date
Nicolas Fella 5d6dfb9012 Update dependency version to 6.30.0 2026-09-04 13:26:17 +02:00
Albert Astals Cid 72518dcc1a jp2: Fix new[] vs delete by not doing new[]
unique_ptr will call delete which is not the right thing to do with
memory allocated with new[]

BUGS: 525120
2026-09-03 00:13:53 +02:00
Mirco MirandaandAlbert Astals Cid a6027264d4 qRoundOrZero_T: fix possible assert in qRound
also:
- qRoundOrZero_T: added documentation
- EXR: I don't set the ISO Speed ​​if it's zero.

BUG: 524678
2026-08-26 22:45:12 +00:00
Daniel Novomeský 47ea774621 autotests: Add non-standard HEIF image 2026-08-24 18:49:54 +02:00
Daniel Novomeský 5ed0affc95 heif: re-enable decoding of non-standard images
BUG: 495686

IMG_20241019_195232.heic stopped decoding recently because
buffer.contains("Xiaomi") is almost all the time false
(only start of the file is stored now),
except sequential devices (full file is stored).
2026-08-24 12:02:58 +02:00
Daniel Novomeský 42e9733060 Add HEIC test files with crop transformation 2026-08-20 22:21:48 +02:00
Daniel Novomeský bae45287ad heif: check crop values 2026-08-20 19:20:10 +02:00
Daniel Novomeský 458257b7a3 jxl: Do not rewind after reading final frame 2026-08-18 08:48:40 +00:00
Aljo Joby 09452b0964 rgb: reject RLE start offsets that underflow the raster data
The start table is stored as file offsets. We subtract the
header+table size to get an index into the remaining data.
If the file offset is smaller than that, the subtract wraps
and the later start+length check can wrap too.

Drop the file instead of walking off the buffer.
2026-08-14 21:03:38 +05:30
Daniel Novomeský c7baa057a6 avif: Do not rewind in jumpToNextImage() 2026-08-10 20:10:46 +02:00
Daniel Novomeský c57af25d36 ossfuzz: call functions used in animations 2026-08-10 17:46:33 +00:00
Nicolas Fella 320ded493a Update version to 6.30.0 2026-08-07 23:07:47 +02:00
Nicolas Fella 8509ac7444 Update dependency version to 6.29.0 2026-08-07 22:22:28 +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
Mirco MirandaandMirco Miranda 516750e6fc Readme: update supported formats 2026-07-28 09:44:58 +02:00
Mirco Miranda 687914f2e7 Test Readme: added JPG support 2026-07-28 07:19:12 +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
Daniel Novomeský abc2ac2de1 autotests: allow JPG as test source
In special cases, JPG with fuzziness value
can be used instead of big PNG files.
2026-07-27 12:33:25 +00:00
Mirco Miranda 66d7d7c154 QOI: check format only in lowercase 2026-07-27 10:05:33 +02:00
Daniel Novomeský 65b4b14d6f ossfuzz: optimize build, collect all HEIF subformats
Upgrade OpenEXR
2026-07-24 16:02:37 +02:00
Daniel Novomeský a4db968c60 fix HEIC writetest 2026-07-23 10:42:33 +02:00
Daniel Novomeský 27c621901d ossfuzz: enable uncompressed codec in libheif
libheif uses ZLIB and Brotli for the uncompressed codec,
so the libheif will be built after libjxl,
which installs brotli libraries.
2026-07-22 17:21:27 +02:00
Daniel Novomeský 7ec1170c86 heif: declare read support for HIF
image/heif MIME type uses following three file extensions:
heif, heic, hif.

Adding HIF into plugin's list.
2026-07-20 18:23:20 +02:00
Mirco MirandaandMirco Miranda c21b50d699 EXIF: add support for Windows Explorer tags 2026-07-20 07:27:34 +02:00
Daniel Novomeský a0825fe5cb heif: increase Maximum number of child boxes limit 2026-07-18 12:59:37 +02:00
Kyle Alexander BuanandDaniel Novomeský ad0fb9dde4 HEIF: keep reader callback table alive
libheif retains the heif_reader pointer after
heif_context_read_from_reader returns. The callback table was scoped
to the non-sequential branch and could be destroyed before
tiled image decoding used it from worker threads.

Give the callback table static storage duration.

BUG: 523105
2026-07-17 10:49:21 +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
Daniel Novomeský c748c6c2c6 heif: AVCI saving, JPEG in HEIF read support
Following compromises were chosen to ensure that saved AVCI
is decodable using OpenH264 decoder:
8-bit only, YUV420 subsampling, lossy compression,
large images encoded via image grid.
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
Nicolas Fella 215305fa4b Update version to 6.29.0 2026-07-03 13:39:38 +02:00
Mirco Miranda e6bc1af5e4 EXR: added support for additional metadata 2026-06-26 09:05:48 +02:00
Nicolas Fella 23e6195b9f Update dependency version to 6.28.0 2026-06-24 20:56:02 +02:00
Mirco Miranda 18322b0659 JP2: limits the maximum number of channels to the global value defined 2026-06-22 08:36:49 +02:00
Daniel Novomeský a5c6239138 ossfuzz: replace INITGUID with __ANSI__
It is more correct way how JXR libraries should be used.
2026-06-21 14:45:09 +02:00
Daniel Novomeský 081975807c JXR: remove INITGUID define
The define caused linking problems on Windows
2026-06-19 16:55:27 +02:00
Daniel Novomeský b58b865ba4 ossfuzz: update libaom and libavif 2026-06-19 16:37:27 +02:00
Mirco MirandaandMirco Miranda 8768a8cf97 HEIF: use heif_reader for random access devices 2026-06-12 08:18:19 +02:00
Akseli Lahtinen 7edf807082 avif: If we only have single image, return false at jumpToNextImage
We were errorneously returning true here, as we do not have any more
images to jump to. If we only have one image, return false.

This avoids the avif handler getting stuck in a loop with only single images.

BUG: 521200
FIXED-IN: 6.28
2026-06-10 15:05:06 +03:00
Mirco MirandaandMirco Miranda 52045ff84d Added limit to maximum number of channels 2026-06-10 04:33:37 +02:00
Laurent Montel 8bfdef2e48 GIT_SILENT: Bump kf ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without kf 6.27 deprecated methods 2026-06-09 06:45:33 +02:00
Mirco MirandaandMirco Miranda ec640db10e Improve buffer memory management 2026-06-06 01:28:31 +02:00
Nicolas Fella 86b0fe60c5 Update version to 6.28.0 2026-06-05 18:02:51 +02:00
Nicolas Fella 2791c2543b Update dependency version to 6.27.0 2026-06-05 17:33:32 +02:00
Mirco Miranda a2a8c955df Updated documentation on memory usage 2026-06-04 07:17:54 +02:00
Mirco Miranda f450e5c9a9 JXR: add a memory allocation barrier in jxrlib 2026-05-27 10:37:09 +02:00
Mirco Miranda 9dfcf67ea9 EXR: reject files with dimensions exceeding 300kx300k pixels 2026-05-25 14:13:15 +02:00
Mirco MirandaandMirco Miranda 6017099044 OSS Fuzz: set image allocation limit to 2000 MiB 2026-05-23 05:59:01 +02:00
Mirco Miranda 9ddad16767 Improve size limits for AVIF, HEIF, and RAW plugins 2026-05-15 12:13:12 +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 d7c3174fb6 DDS: fix mime type 2026-05-08 04:58:39 +02:00
Mirco MirandaandMirco Miranda 49a8fd38c8 IFF: DEEP image support 2026-05-08 01:29:54 +02:00
Mirco Miranda 1206598337 imageAlloc: add image initialization support 2026-05-07 08:41:10 +02:00
Mirco Miranda 3488077d8d Fix uninitialized value 2026-05-04 08:51:34 +02:00
Laurent Montel ea8a4dccdc GIT_SILENT: Bump kf ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without kf 6.26 deprecated methods 2026-05-03 08:41:08 +02:00
Mirco MirandaandMirco Miranda 8048279473 HEIF: image transformation support 2026-05-03 00:00:11 +02:00
Nicolas Fella 18d0f93d60 Update CI image 2026-05-02 15:30:10 +02:00
Nicolas Fella 497e612ad3 Update version to 6.27.0 2026-05-01 22:24:21 +02:00
Nicolas Fella 84f28e8bc9 Update dependency version to 6.26.0 2026-05-01 13:20:34 +02:00
Mirco Miranda a936927ec1 JXR: check all library return codes 2026-04-26 06:22:30 +02:00
Mirco Miranda 191e5e6a69 EXIF improvements and bugfixes
- Fixes a writing issue for float values ​​less than 1
- Fixes a missing definition of `EXIF_DATETIMEDIGITIZED` tag
- Adds support for some common camera shot metadata
- Adds missing metadata to writing tests

The following plugins automatically gain support for the new metadata: AVIF, IFF, HEIF, JXL, JXR, PSD and TGA (V2E).

The new metadata added with this patch is usually saved by smartphones (e.g. iPhone or Google Pixel).
2026-04-26 06:08:25 +02:00
Mirco MirandaandMirco Miranda 51db11eefc JXR: fix Use-of-uninitialized-value 2026-04-23 14:44:45 +02:00
Mirco Miranda bc398382ac EXR: fix Null-dereference READ in OpenEXR 2026-04-23 11:42:16 +02:00
Mirco MirandaandAlbert Astals Cid d5e5012cfb HDR: fix incorrect use of s.atEnd() 2026-04-20 12:49:35 +00:00
Mirco Miranda 1b3f32a332 JXR: minimal support for multichannel 3 and 4 2026-04-20 14:13:10 +02:00
Mirco Miranda 7cf60da031 JXR: fix memory leaks 2026-04-19 20:37:27 +02:00
Mirco MirandaandAlbert Astals Cid d160f268e7 Improved documentation for DDS, JP2 and PSD formats 2026-04-18 08:32:32 +00: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 Miranda 2d2ee68cc0 Add more info about unsecure JXR plugin 2026-04-13 12:45:09 +02:00
Nicolas Fella d15c3c679d Update version to 6.26.0 2026-04-03 19:49:32 +02:00
Nicolas Fella eb896efea1 Update dependency version to 6.25.0 2026-04-03 18:34:25 +02:00
Mirco MirandaandMirco Miranda 142ec14c81 TIM: PlayStation graphics read only support 2026-03-24 08:38:08 +01:00
Albert Astals Cid 38b8b70304 Remove ifdef now that we depend on Qt >= 6.9.0 2026-03-23 22:57:17 +01:00
Albert Astals Cid e28c48cfeb GIT_SILENT Upgrade CMake version requirement to 3.29.
See https://community.kde.org/Frameworks/Policies
2026-03-23 19:30:35 +01:00
Albert Astals Cid 3c08226aec GIT_SILENT Upgrade Qt6 version requirement to 6.9.0.
See https://community.kde.org/Frameworks/Policies
2026-03-23 19:13:47 +01:00
Mirco Miranda 7c86ccaefb IFF: fix Integer-overflow in IDATChunk::strideSize 2026-03-23 12:05:01 +01:00
Nicolas Fella ec0610d5b0 Update version to 6.25.0 2026-03-07 22:30:10 +01:00
Nicolas Fella ae279c55f4 Update dependency version to 6.24.0 2026-03-07 21:18:31 +01:00
Mirco Miranda 836e0a53bb JP2: fix possible Undefined-shift 2026-03-04 08:15:48 +01:00
Mirco Miranda 5eb09116b0 IFF: fix buffer read overflow 2026-02-24 08:57:45 +01:00
Mirco MirandaandAlbert Astals Cid 92368ca58f Fix Heap-buffer-overflow WRITE 2026-02-22 18:27:34 +00:00
Mirco Miranda a91c7ef72f Fixed excessively frequent warning messages 2026-02-22 14:56:21 +01:00
Daniel Novomeský ea2a4aafab ossfuzz: update aom, libavif, openjpeg 2026-02-19 11:31:12 +01:00
Mirco Miranda c254875780 ANI: fix possible QByteArray allocation exception 2026-02-16 10:12:05 +01:00
Daniel Novomeský f3de2e77c1 jxl: adjust metadata size limits
Previously there was no limit for uncompressed metadata,
but when compressed metadata required buffer larger than 4MB,
image decoding stopped.

Now the plugin discards/skips metadata boxes larger than 8MB
without stopping image decoding.
If size of compressed box is above 8MB,
we do not attempt to decompress it.
File with compressed metadata could be rejected only in rare cases
when the decompression buffer grows above 32MB (four times 8M).
2026-02-13 15:44:39 +01:00
Mirco Miranda 1ef779f370 RGB: fix a possible exception on the new 2026-02-12 13:42:58 +01:00
Laurent Montel 169a874cba GIT_SILENT: Bump kf ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without kf 6.23 deprecated methods 2026-02-10 07:52:45 +01:00
Mirco MirandaandAlbert Astals Cid ebf77ccdf5 TGA: fix Undefined-shift 2026-02-09 23:02:06 +00:00
Mirco MirandaandAlbert Astals Cid 359cb039d2 PSD: improve conversion sanity checks 2026-02-09 22:50:51 +00:00
Mirco MirandaandAlbert Astals Cid f4b91d8a54 IFF: fix compilation warnings 2026-02-09 22:46:04 +00:00
Mirco Miranda 263b5a88e2 ANI: check for array allocation size 2026-02-09 08:41:40 +01:00
Nicolas Fella 8d07f7db1b Update version to 6.24.0 2026-02-06 13:31:01 +01:00
Nicolas Fella 1c2210c100 Update dependency version to 6.23.0 2026-02-06 13:01:56 +01:00
Azhar Momin b7b438f903 Fix oss-fuzz AFL build (again) 2026-02-03 14:35:56 +05:30
Azhar MominandAlbert Astals Cid 336b8906aa Fix OSS-Fuzz AFL builds 2026-02-02 23:05:09 +00:00
Kai Uwe Broulik 2c8a1ad6ff GIT_SILENT anitest: Fix typo
text -> test
2026-01-30 17:36:12 +01:00
Mirco Miranda e0f1ba640a IFF: add uncompressed RGFX support 2026-01-27 13:58:01 +01:00
Mirco MirandaandAlbert Astals Cid 32773e5f0c IFF: add CD-i Rle7 support 2026-01-20 21:17:08 +00:00
Mirco Miranda 2410e45614 Decode Atari ST VDAT chunks 2026-01-20 10:20:32 +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ý 3353809906 jxl: fix crash on lossy gray images
There was a rare crash during decoding of some lossy gray images.
Problem was reported in https://github.com/libjxl/libjxl/issues/4549
This is a workaround which avoids JxlDecoderSetCms call.
2026-01-11 15:03:06 +01:00
Daniel Novomeský abf4d32858 Add gray AVIF files with various transfer functions 2026-01-10 20:41:52 +00:00
Daniel Novomeský 6b1c52c55c avif: Improved color profiles support 2026-01-10 20:41:52 +00:00
Albert Astals Cid e644ab997f GIT_SILENT Upgrade CMake version requirement to 3.27.
See https://community.kde.org/Frameworks/Policies
2026-01-10 00:13:59 +01:00
Nicolas Fella 1fb3363e7b Update version to 6.23.0 2026-01-02 18:59:54 +01:00
Nicolas Fella 19df8b03a8 Update dependency version to 6.22.0 2026-01-02 18:32:32 +01: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
Daniel Novomeský 8c9a7e88e5 avif: YCgCo-Re decoding fix 2025-12-26 00:47:46 +00:00
Mirco MirandaandMirco Miranda 30308f3541 HEIF tests skipped using kde-ci.yml 2025-12-24 17:56:44 +01:00
Laurent Montel af4597f796 GIT_SILENT: Bump qt ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without qt 6.11 deprecated methods 2025-12-24 06:57:32 +01:00
Laurent Montel b8b9849268 GIT_SILENT: Bump kf ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without kf 6.21 deprecated methods 2025-12-18 22:07:02 +01:00
Mirco Miranda db1cb8de1f Add allocation limit test (0/256 MiB) 2025-12-09 15:55:35 +01:00
Albert Astals Cid 956b86c4de allocationLimit = 0 means no limit 2025-12-09 01:06:10 +01:00
Nicolas Fella 282c277204 Update version to 6.22.0 2025-12-05 15:14:46 +01:00
Nicolas Fella 237f25fd20 Update dependency version to 6.21.0 2025-12-05 14:07:10 +01:00
Kunda Ki 5140567853 Fix various typos in the codebase
Fixes mostly source documentation, comments, and some user-facing typos.
Found via `codespell -q 3 -S "*.eps,*.raw" -L ahd,siz,widthn`
2025-12-05 10:41:17 +00:00
Mirco Miranda 72a809bcfd XCF: initialize tiles and buffers 2025-11-22 12:45:46 +01:00
Mirco Miranda 731ac375bb HDR: fix uninitialized buffer 2025-11-22 09:41: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 MirandaandAlbert Astals Cid 472ff92b96 PSD: fix use of uninitialized tmp image 2025-11-21 01:21:18 +00:00
Mirco Miranda 847510f109 EXR: fix of uninitialized RGB read buffer 2025-11-20 07:36:49 +01:00
Mirco MirandaandAlbert Astals Cid a8ad7be1cd RGB: fix Use-of-uninitialized-value 2025-11-19 11:05:36 +00:00
Mirco Miranda 7202e77c74 HDR: readHeader() sanity checks 2025-11-18 16:56:46 +01:00
Mirco Miranda 379c3c1738 PSD: return error if a complete line is read/decompressed 2025-11-17 14:38:07 +01:00
Nicolas Fella 6519d2930e Update version to 6.21.0 2025-11-14 18:25:25 +01:00
Nicolas Fella ffcfa49f13 Update dependency version to 6.20.0 2025-11-07 19:26:04 +01:00
Mirco Miranda d3d4bea2f1 PSD: limit memory usage on corrupted files 2025-11-07 15:36:31 +01:00
Albert Astals CidandMirco Miranda cfbeb397a8 Fix assert on broken data
Change the isnan test to !isfinite. This way we include infinite numbers
too as not accepted
2025-11-05 23:16:03 +01:00
Mirco Miranda 1c6ce2437e PSD: minor fixes while reading Image resource Section 2025-11-03 08:27:17 +01:00
Laurent Montel 3d9f1c4e9e GIT_SILENT: Bump kf ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without kf 6.19 deprecated methods 2025-11-02 16:07:02 +01:00
Mirco Miranda e7d01c286f IFF: fix crash on malformed files 2025-10-31 09:07:40 +01:00
Albert Astals Cid dfda863841 iff: Fix crash on malformed files
oss-fuzz/455510771
2025-10-28 00:50:06 +01:00
Mirco Miranda 3d4d74fc02 PSD: improve sections size checks 2025-10-24 08:39:58 +02:00
Mirco Miranda 326e56029a TGA: ignoring large metadata on dev area 2025-10-23 14:54:52 +02:00
Mirco MirandaandMirco Miranda e8e5b091bc Check device before read 2025-10-23 12:18:59 +02:00
Mirco Miranda aeb2988eec Fix possible infinite loop when reading a broken jp2 2025-10-23 11:59:39 +02:00
Mirco MirandaandAlbert Astals Cid abfda2ce69 On demand buffer allocation on PCHG decompression 2025-10-23 07:58:58 +00:00
Mirco Miranda d6d67c7b8b Fix possible read overflow with malformed data 2025-10-23 08:23:57 +02:00
Mirco Miranda 54c94764d1 Fix wrong palette check 2025-10-21 19:33:12 +02:00
Mirco MirandaandMirco Miranda 7512874620 Use internal FP32 conversion instead of FP16 2025-10-18 05:43:08 +02:00
Mirco Miranda 146f637385 Fix read test failing on aarch64 2025-10-17 13:43:24 +02:00
Albert Astals Cid 436310b4f0 Remove Qt version checks now that 6.8.0 is the minimum required 2025-10-16 20:20:35 +02:00
Albert Astals Cid d8a8bcb68e GIT_SILENT Upgrade Qt6 version requirement to 6.8.0.
See https://community.kde.org/Frameworks/Policies
2025-10-16 19:10:25 +02:00
Albert Astals Cid 2b80a0a55a Fix assert on broken data
The nan eventually ends up in qRound inside Qt code.
That asserts because it doesn't know what to do with a nan
2025-10-14 23:55:59 +02:00
Albert Astals Cid 8e164474b4 CI: Try newer libjxl for ossfuzz 2025-10-13 11:34:15 +02:00
Albert Astals CidandMirco Miranda 4c52480b73 tga: Reduce Warning to Debug
It happens that apps have an unknown source and ask if they can read it,
we should not show a weird warning to the user
2025-10-12 15:14:41 +02:00
Mirco Miranda 19faa55a6d Fix crash on malformed files 2025-10-10 09:03:18 +02:00
Mirco Miranda b9bfeedbc1 Fix crash on malformed files 2025-10-06 01:04:40 +02:00
Nicolas Fella 3c8539d53d Update version to 6.20.0 2025-10-05 15:16:13 +02:00
Nicolas Fella d332ad717b Update dependency version to 6.19.0 2025-10-03 15:04:37 +02:00
Albert Astals Cid 1ca7baed98 Fix assert on broken data
The nan eventually ends up in qRound inside Qt code.
That asserts because it doesn't know what to do with a nan
2025-10-02 01:02:08 +02:00
Albert Astals Cid f1b0c9f0ec add const so we know that QImage is not being modified 2025-10-01 19:15:10 +02:00
Mirco Miranda b83f4c0231 Add color space check during read test 2025-09-27 11:12:50 +02:00
Mirco Miranda a457e5ddcb Limits the max RAW size to 300000x300000 pixels 2025-09-21 15:13:17 +02:00
Mirco Miranda f28cd98661 Limits the max DDS size to 300000x300000 pixels 2025-09-21 11:28:45 +02:00
Jiaqi Wu 05c3a1afe6 Fix compilation failure with Qt 6.7 2025-09-20 13:37:52 +08:00
Mirco Miranda fda751c641 Switch all plugins to QLoggingCategory 2025-09-19 10:00:26 +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
Azhar MominandAlbert Astals Cid 14286a6ab0 Add a CI job for oss-fuzz 2025-09-13 10:15:10 +00:00
Laurent Montel 945fd6f0ce GIT_SILENT: Bump kf ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without kf 6.18 deprecated methods 2025-09-13 08:53:25 +02:00
Albert Astals Cid c36b4e2350 Use std::lround instead of qRound
qRound will assert if the resulting integer is out of range, by using
lround we can ask if the rounding range failed
2025-09-11 13:50:50 +02:00
Mirco Miranda 95f0d15e14 RAW: Disable broken stream protection
It seems that on BSD the definition introduced with MR !384 crashes Telegram.
2025-09-11 11:52:21 +02:00
Mirco Miranda 56c8bc7323 Add checks on the seek return value 2025-09-09 22:20:34 +02:00
Mirco Miranda 08e178f098 Fix Null-dereference READ 2025-09-09 21:15:19 +02:00
Mirco MirandaandAlbert Astals Cid 6881e3111b HDR: Limits the header to the first 128 lines
The HDR header is a set of text information spread across a few lines. 
According to the specifications I have, the parameters seem to be a total of 7 / 8 but there could be more. This patch limits the header to 128 lines of maximum 1024 bytes.

Closes #40
2025-09-09 13:59:14 +00: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 Miranda 8036b1d032 Fix assert when read corrupted floats 2025-09-08 11:01:06 +02:00
Nicolas Fella 71cc137254 Update version to 6.19.0 2025-09-08 10:23:10 +02:00
Nicolas Fella 7858c4eeec Update dependency version to 6.18.0 2025-09-07 14:25:38 +02:00
Albert Astals Cid eae41980b2 dds: Fix assert when reading broken data
oss-fuzz testcase 6027629841154048
2025-09-06 22:39:16 +00:00
Laurent Montel 3bf2281610 GIT_SILENT: Use Qt CamelCase includes 2025-09-04 08:32:52 +02:00
Mirco Miranda 59089855fa Unified maximum pixel value for large image plugins 2025-08-30 09:17:58 +02:00
Mirco Miranda 5a067130af Removed the conversion of the entire image to a compatible format when saving from the PCX, PIC, and RGB plugins.
For example, the PCX plugin converts all RGB images to RGB(A)32. So if you try to save a 1 GiB RGB888 image, it will be converted to RGB32 image so, you need additional 1.25GiB of ram. The conversion now occurs line by line, significantly saving memory.
2025-08-30 09:17:40 +02: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 Miranda f933cbe12d Fix possible buffer overflow on corrupted images 2025-08-22 08:08:17 +02:00
Mirco MirandaandAlbert Astals Cid ebc366b3c5 TGA: memory optimizations and native grayscale support
- Removed temporary buffer of uncompressed image size when reading (loads images using half the memory)
- Added native support for Grayscale images (they are no longer converted to RGB(A) 32 when reading/writing)
- Fixes wrong X channel value on RGBX32 images (CCBUG: 499584)

It should also reduce loading times for corrupted images.

Closes #33
2025-08-20 21:53:00 +00:00
Azhar Momin bc8b5b56b1 Move fuzz target and build script into KImageFormats repository 2025-08-20 22:57:06 +05:30
Laurent Montel 35a1ed0227 GIT_SILENT: Bump kf ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without kf 6.17 deprecated methods 2025-08-15 08:29:20 +02:00
Mirco Miranda f63b082c85 IFF: add support for a different palette per line 2025-08-12 08:28:31 +02:00
Mirco Miranda 68cc915132 IFF: Fix possible undefined-shift 2025-08-09 11:46:05 +02:00
Mirco MirandaandAlbert Astals Cid e912a4ac9b RAW: Error out on malformed files
Internally, LibRaw often doesn't check the return values of various functions. It's not uncommon to find things like:

fseek(ifp, oAtom, SEEK_SET);
szAtom = get4();
... (more read operations without checking the result)

This means is up to us to error our properly when something went wrong. We do that by keeping an error counter and calling IOERROR once we've reached enough errors. IOERROR will throw an exception that will be internally caught by libraw itself.
2025-08-07 20:39:55 +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 4b44f8474f Fix oss-fuzz compilation error 2025-08-04 13:46:16 +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
Nicolas Fella cd39c36621 Update version to 6.18.0 2025-08-01 13:33:36 +02:00
Nicolas Fella 1bfae6f171 Update dependency version to 6.17.0 2025-08-01 12:14:50 +02:00
Mirco Miranda fd864e6f55 IFF: add support for uncompressed ACBM type 2025-07-24 07:37:58 +02:00
Laurent Montel 16b669d63d Bump kf ecm_set_disabled_deprecation_versions. Make sure that it compiles fine without kf 6.16 deprecated methods 2025-07-21 20:30:44 +02:00
Albert Astals Cid 457f3afa24 Fix CI
GIT_SILENT
2025-07-20 21:43:36 +00:00
Laurent Montel 080fd3c72d It compiles fine without qt 6.10 deprecated methods 2025-07-20 21:42:04 +02:00
Mirco Miranda 1d69f6af57 IFF: add mime types and extensions 2025-07-17 07:32:26 +02:00
Allen Winter 083680eb77 chunks.cpp - send info and warning messages to the iff logging category
For example:
`IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"`

becomes:
`kf.imageformats.plugins.iff: IFFChunk::innerFromDevice: unknown chunk "\x89PNG"`

bonus: we can filter out such messages if we want using QT_LOGGING_RULES

also note the spelling fix
2025-07-16 11:00:54 -04:00
Mirco Miranda 0a9f9fe106 IFF: support for Ham8, HalfBride, Pbm and ILBM 32-bits modes 2025-07-15 07:38:19 +02:00
Kai Uwe BroulikandMirco Miranda 21b3b890ec tga: Be less strict about palette
There's images in the wild that claim to not have a palette
but still have one.
2025-07-09 13:17:20 +02:00
Mirco Miranda aef4bd7e1c Fix unused param in MicroExif::toByteArray() 2025-07-07 08:17:36 +02:00
Mirco MirandaandAlbert Astals Cid ea1983a7d1 IFF: Fix possible stack overflow 2025-07-05 09:59:06 +00:00
Nicolas Fella 775b53f1f6 Update version to 6.17.0 2025-07-04 18:28:45 +02:00
Nicolas Fella 02cf1502c0 Update dependency version to 6.16.0 2025-07-04 16:29:08 +02:00
Mirco Miranda f6c718a789 TGA: add indexed write support
Indexed images are saved as uncompressed TGA with color map.

Closes #30
2025-07-03 07:36:33 +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
Nicolas Fella 094177a01c Update version to 6.16.0 2025-06-06 16:31:26 +02:00
Nicolas Fella 7420f47c17 Update dependency version to 6.15.0 2025-06-06 15:19:44 +02:00
Xaver Hugl 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
Mirco Miranda e3aefd2aa1 JXR: Restore device position after reading options 2025-05-14 02:50:03 +02:00
Mirco Miranda aa8134ee0d README.md: minor fixes and improvements 2025-05-06 07:33:27 +02:00
Laurent Montel 9f09473aa0 It compiles fine without kf_6_13 deprecated methods 2025-05-04 21:31:49 +02:00
Mirco Miranda 62eb1d28cb Add README about autotests 2025-05-03 11:01:46 +02:00
Nicolas Fella 15bece40ec Update version to 6.15.0 2025-05-02 17:10:02 +02:00
Nicolas Fella 1b3d2afbe3 Update dependency version to 6.14.0 2025-05-02 16:02:43 +02:00
Mirco Miranda 850068c1dc JXR: fix compilation error on 32-bit systems 2025-04-22 08:01:02 +02:00
Mirco MirandaandAlbert Astals Cid 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
Alessandro Astone 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
Daniel Novomeský 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
Mirco MirandaandAlbert Astals Cid 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
Nicolas Fella 9c47845f15 Update version to 6.14.0 2025-04-10 19:53:58 +02:00
Volker Krause 7c7fa73020 Remove conditions for no longer supported Qt versions 2025-04-08 18:46:13 +02:00
Albert Astals Cid 92e4271e84 GIT_SILENT Upgrade Qt6 version requirement to 6.7.0. 2025-04-07 10:13:41 +02:00
Laurent Montel 6f588c6fd3 Add missing include mocs 2025-04-03 07:34:17 +02:00
Laurent MontelandAlbert Astals Cid a182478e2c It compiles fine without qt6.9 deprecated methods 2025-03-23 22:52:05 +00:00
Mirco MirandaandAlbert Astals Cid 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
Laurent Montel bef2b9168f It compiles fine without kf6.12 deprecated methods 2025-03-22 06:47:20 +01:00
Daniel Novomeský 473f5d9847 Write tests for hej2 format 2025-03-16 21:31:46 +01:00
Daniel Novomeský 9bee29cc01 heif: enable saving of hej2 format 2025-03-16 18:37:48 +01:00
Nicolas Fella cdf3be3af1 Update dependency version to 6.13.0 2025-03-14 21:31:42 +01:00
Albert Astals CidandDaniel Novomeský 752b18a42c CI: Enable heif so we make sure it compiles 2025-03-12 16:17:29 +00:00
Daniel Novomeský 97a1ea181c writetest: special handling for HEIF format 2025-03-12 16:41:39 +01:00
Daniel Novomeský 64a43fb04f readtest: special handling for HEIF format 2025-03-12 16:17:59 +01:00
Daniel Novomeský 6821c29819 heif: disable AVCI decoder for libheif before 1.19.6 2025-03-12 13:26:42 +01:00
Daniel Novomeský e4d95c03fa SKIP tests when libheif configuration is incomplete 2025-03-10 22:01:14 +01:00
Daniel Novomeský afa8ed1a5d heif: enable reading images with native 16 bit depth 2025-03-10 19:42:34 +01:00
Mirco Miranda 245c835d92 Use of heif_context_add_XMP_metadata instead
heif_context_add_XMP_metadata2
2025-03-09 10:44:18 +01:00
Nicolas Fella b2663d2651 Update dependency version to 6.13.0 2025-03-07 19:00:23 +01:00
439 changed files with 15413 additions and 1621 deletions
+2 -1
View File
@@ -12,10 +12,11 @@ include:
- /gitlab-templates/windows-qt6.yml
- /gitlab-templates/xml-lint.yml
- /gitlab-templates/yaml-lint.yml
- /gitlab-templates/oss-fuzz.yml
image_json_validate:
stage: validate
image: invent-registry.kde.org/sysadmin/ci-images/suse-qt68:latest
image: invent-registry.kde.org/sysadmin/ci-images/suse-qt611:latest
tags:
- Linux
script:
+1 -1
View File
@@ -7,5 +7,5 @@ Dependencies:
Options:
test-before-installing: True
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
cmake-options: "-DKIMAGEFORMATS_DDS=ON -DKIMAGEFORMATS_JXR=ON"
cmake-options: "-DKIMAGEFORMATS_WITH_KNOWN_CRASHES_JXR=ON -DKIMAGEFORMATS_HEIF=ON -DKIMAGEFORMATS_HEIC_TEST:STRING=OFF -DKIMAGEFORMATS_HEIF_TEST:STRING=OFF -DKIMAGEFORMATS_HEJ2_TEST:STRING=OFF -DKIMAGEFORMATS_AVCI_TEST:STRING=OFF"
per-test-timeout: 90
+43 -15
View File
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.29)
set(KF_VERSION "6.12.0") # handled by release scripts
set(KF_DEP_VERSION "6.12.0") # handled by release scripts
set(KF_VERSION "6.30.0") # handled by release scripts
set(KF_DEP_VERSION "6.30.0") # handled by release scripts
project(KImageFormats VERSION ${KF_VERSION})
include(FeatureSummary)
find_package(ECM 6.12.0 NO_MODULE)
find_package(ECM 6.30.0 NO_MODULE)
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)
@@ -21,7 +21,7 @@ include(ECMDeprecationSettings)
include(CheckIncludeFiles)
include(FindPkgConfig)
set(REQUIRED_QT_VERSION 6.6.0)
set(REQUIRED_QT_VERSION 6.9.0)
find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
find_package(KF6Archive ${KF_DEP_VERSION})
@@ -53,10 +53,7 @@ set_package_properties(OpenEXR PROPERTIES
PURPOSE "Required for the QImage plugin for OpenEXR images"
)
find_package(libavif 0.8.2 CONFIG QUIET)
if(NOT libavif_FOUND)
find_package(libavif 1 CONFIG)
endif()
find_package(libavif 1 CONFIG)
set_package_properties(libavif PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for the QImage plugin for AVIF images"
@@ -65,8 +62,16 @@ set_package_properties(libavif PROPERTIES
option(KIMAGEFORMATS_DDS "Enable plugin for DDS format" ON)
option(KIMAGEFORMATS_HEIF "Enable plugin for HEIF format" OFF)
set(KIMAGEFORMATS_HEIC_TEST "ALL" CACHE STRING "Enable HEIC tests: OFF, READ_ONLY, ALL")
set_property(CACHE KIMAGEFORMATS_HEIC_TEST PROPERTY STRINGS "OFF" "READ_ONLY" "ALL")
set(KIMAGEFORMATS_HEIF_TEST "ALL" CACHE STRING "Enable HEIF tests: OFF, ALL")
set_property(CACHE KIMAGEFORMATS_HEIF_TEST PROPERTY STRINGS "OFF" "ALL")
set(KIMAGEFORMATS_HEJ2_TEST "ALL" CACHE STRING "Enable HEJ2 tests: OFF, READ_ONLY, ALL")
set_property(CACHE KIMAGEFORMATS_HEJ2_TEST PROPERTY STRINGS "OFF" "READ_ONLY" "ALL")
set(KIMAGEFORMATS_AVCI_TEST "ALL" CACHE STRING "Enable AVCI tests: OFF, ALL")
set_property(CACHE KIMAGEFORMATS_AVCI_TEST PROPERTY STRINGS "OFF" "ALL")
if(KIMAGEFORMATS_HEIF)
pkg_check_modules(LibHeif IMPORTED_TARGET libheif>=1.10.0)
pkg_check_modules(LibHeif IMPORTED_TARGET libheif>=1.17.0)
endif()
add_feature_info(LibHeif LibHeif_FOUND "required for the QImage plugin for HEIF/HEIC images")
@@ -91,16 +96,17 @@ set_package_properties(LibRaw PROPERTIES
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)
# JXR plugin disabled by default due to security issues.
# You should not enable it unless you know what you are doing.
option(KIMAGEFORMATS_WITH_KNOWN_CRASHES_JXR "Enable plugin for JPEG XR format" OFF)
if(KIMAGEFORMATS_WITH_KNOWN_CRASHES_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.8.0
KF 6.11.0
QT 6.11.0
KF 6.27.0
)
add_subdirectory(src)
@@ -109,6 +115,28 @@ if (BUILD_TESTING)
add_subdirectory(tests)
endif()
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)
+5
View File
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2025 Xaver Hugl <[email protected]>
# SPDX-License-Identifier: BSD-2-Clause
@PACKAGE_INIT@
# empty, because this is plugins for Qt instead of a library to link against
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+192 -33
View File
@@ -16,10 +16,13 @@ The following image formats have read-only support:
- Animated Windows cursors (ani)
- Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
- Farbfeld (ff)
- Gimp (xcf)
- Interchange Format Files (iff, ilbm, lbm)
- Krita (kra)
- OpenRaster (ora)
- Pixar raster (pxr)
- PlayStation graphics (tim)
- Portable FloatMap/HalfMap (pfm, phm)
- Photoshop documents (psd, psb, pdd, psdt)
- Radiance HDR (hdr)
@@ -28,13 +31,13 @@ The following image formats have read-only support:
The following image formats have read and write support:
- AV1 Image File Format (avif)
- AV1 Image File Format (avif, avifs<sup>1</sup>)
- DirectDraw Surface (dds)
- Encapsulated PostScript (eps)
- High Efficiency Image File Format (heif)
- JPEG 2000 (jp2, j2k, jpf)
- High Efficiency Image File Format (avci<sup>2</sup>, heic<sup>2</sup>, heif<sup>2</sup>, hej2<sup>2</sup>, hif<sup>2</sup>)
- JPEG 2000 (jp2, j2k, jpf<sup>1</sup>)
- JPEG XL (jxl)
- JPEG XR (jxr)
- JPEG XR (jxr, hdp<sup>1</sup>, wdp<sup>1</sup>)
- OpenEXR (exr)
- Personal Computer Exchange (pcx)
- Quite OK Image format (qoi)
@@ -42,6 +45,11 @@ The following image formats have read and write support:
- Softimage PIC (pic)
- Targa (tga): supports more formats than Qt's version
Footnotes:
1. Read only support.
2. It depends on the HEIF plugins installed.
## Contributing
See the [`QImageIOPlugin`](https://doc.qt.io/qt-6/qimageioplugin.html)
@@ -53,11 +61,19 @@ willing to sign the Qt Project contributor agreement, it may be better to
submit the plugin directly to the Qt Project.
To be accepted, contributions must:
- Contain the test images needed to verify that the changes work correctly
- Pass the tests successfully
- Contain the test images needed to verify that the changes work correctly.
- Pass the tests successfully.
- Use Qt logging categories for Debug messages.
For more info about tests, see also [Autotests README](autotests/README.md).
## Duplicated Plugins
> [!important]
> To ensure you are using the correct plugin, the unwanted one should be
renamed or deleted. If several plugins support the same capability, Qt will
select one arbitrarily.
### The TGA plugin
The TGA plugin supports more formats than Qt's own TGA plugin;
@@ -135,6 +151,7 @@ About the image:
scanned.
- `HostComputer`: The computer and/or operating system in use at the time
of image creation.
- `Keywords`: Keywords, separated by semicolons, that represent the image.
- `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
@@ -143,10 +160,35 @@ About the image:
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.
- `Rating`: Integer number indicating the image rating (usually between 1
and 5).
- `Software`: Name and version number of the software package(s) used to
create the image.
- `Speed`: Floating-point number indicating the speed of GPS receiver
movement in Km/h (e.g. 30.2).
- `Title`: The title of the image.
About the shot:
- `DigitalZoomRatio`: Floating-point number indicating the digital zoom ratio
when the image was shot.
- `ExposureMode`: Integer number indicating the exposure mode set when the
image was shot as reported in the EXIF specifications.
- `ExposureProgram`: Integer number indicating the class of the program used
by the camera to set exposure when the picture is taken as reported in the
EXIF specifications.
- `ExposureTime`: Floating-point number indicating the exposure time,
given in seconds (s).
- `Flash`: Integer number indicating the status of flash when the image
was shot as reported in the EXIF specifications.
- `FNumber`: Floating-point number indicating the F number.
- `FocalLength`: Floating-point number indicating the actual focal length
of the lens, in millimeters (mm).
- `ISOSpeedRatings`: Integer number indicating the sensitivity of the camera
or input device when the image was shot as reported in the EXIF
specifications.
- `WhiteBalance`: Integer number indicating the white balance mode set when
the image was shot as reported in the EXIF specifications.
About the camera:
- `Manufacturer`: The manufacturer of the recording equipment.
- `Model`: The model name or model number of the recording equipment.
@@ -209,32 +251,41 @@ RGB.
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).
Anyway, all plugins are also limited by the
`QImageReader::allocationLimit()`.
- ANI: n/a
> [!note]
> You can change the maximum limit of 300000 pixels by setting the constant
> `KIF_LARGE_IMAGE_PIXEL_LIMIT` to the desired value in the cmake file. It
> cannot be less than 65536.
Below are the maximum sizes for each plugin ('n/a' means no limit, i.e. the
limit depends on the format encoding).
- ANI: same size as Qt's ICO plugin
- AVIF: 32,768 x 32,768 pixels, in any case no larger than 256 megapixels
- DDS: n/a
- DDS: 300,000 x 300,000 pixels
- EXR: 300,000 x 300,000 pixels
- EPS: n/a
- HDR: n/a (large image)
- HEIF: n/a
- EPS: same size as Qt's JPG plugin
- FF: 300,000 x 300,000 pixels
- HDR: 300,000 x 300,000 pixels
- HEIF: 65,535 x 65,535 pixels
- IFF: 65,535 x 65,535 pixels
- 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
- JXR: 300,000 x 300,000 pixels, 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)
- PFM: 300,000 x 300,000 pixels
- 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)
- RAS: 300,000 x 300,000 pixels
- RAW: 65,535 x 65,535 pixels
- RGB: 65,535 x 65,535 pixels
- SCT: 300,000 x 300,000 pixels
- TIM: 65,535 x 65,535 pixels
- TGA: 65,535 x 65,535 pixels
- XCF: 300,000 x 300,000 pixels
@@ -257,8 +308,18 @@ 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.
Note that the value of `QImageReader::allocationLimit()` is only used when
allocating a new `QImage`. Since this parameter was created to limit damage
caused by corrupted files, any conversion of `QImage` (for example, with
`QImage::convertTo()`) is not subject to this limit.
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.
Plugins that use external libraries don't always allow progressive decoding
(e.g., the JPEG series). In these cases, the memory required for reading
may be much larger than the entire decoded image. When the external library has
a maximum memory limit function, the value of `QImageReader::allocationLimit()`
is set.
### Non-RGB formats
@@ -275,9 +336,14 @@ 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
- `DDS_DISABLE_STRIDE_ALIGNMENT`: disable the stride alignment based on DDS
pitch: it is known that some writers do not set it correctly.
When writing, it is possible to set which pixel format to use by setting the
subtypes. The default is `Automatic` which chooses the most appropriate format
based on the image. For a complete list of subformats, please use the
appropriate [`QImageWriter`](https://doc.qt.io/qt-6/qimagewriter.html) APIs.
### The HEIF plugin
**This plugin is disabled by default. It can be enabled by settings
@@ -288,6 +354,30 @@ 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 following defines can be defined in cmake to modify the behavior of the
plugin:
- `HEIF_DISABLE_QT_TRANSFORMATION`: HEIF transformations, in addition to
rotations and reflections, also support image cropping. Consequently, the
Qt plugin, must also honor the crop. This define is useful in case
of problems: activating it disables Qt's support for transformations,
delegating them to the HEIF libraries (which will therefore always apply
them regardless of what is requested from Qt).
**If you are interested in compiling the plugin without running the tests,
also use the following string options:**
- `KIMAGEFORMATS_HEIC_TEST` to change the behaviour of HEIC tests. Set to
`"OFF"` (no test at all) or `"READ_ONLY"` (run read tests only).
Required codecs: HEVC / H.265.
- `KIMAGEFORMATS_HEIF_TEST` to change the behaviour of HEIF tests. Set to
`"OFF"` (no test at all).
Required codecs: uncompressed, deflate, zlib, brotli, jpeg.
- `KIMAGEFORMATS_HEJ2_TEST` to change the behaviour of HEJ2 tests. Set to
`"OFF"` (no test at all) or `"READ_ONLY"` (run read tests only).
Required codecs: JPEG 2000.
- `KIMAGEFORMATS_AVCI_TEST` to change the behaviour of AVCI tests. Set to
`"OFF"` (no test at all).
Required codecs: Advanced Video Coding / H.264.
### The EXR plugin
The following defines can be defined in cmake to modify the behavior of the
@@ -298,6 +388,10 @@ plugin:
attribute named "xmp". Note that Gimp reads the "xmp" attribute and Darktable
writes it as well.
The plugin can set the following additional metadata:
- `EXRLayerName`: A string containing the name of the EXR layer used to decode
the image.
### The EPS plugin
The plugin uses `Ghostscript` to convert the raster image. When reading it
@@ -313,6 +407,37 @@ plugin:
- `HDR_HALF_QUALITY`: on read, a 16-bit float image is returned instead of a
32-bit float one.
### The IFF plugin
Interchange File Format is a chunk-based format. Since the original 1985
version, various extensions have been created over time.
The plugin supports the following image data:
- FORM ILBM (Interleaved Bitmap): Electronic Arts IFF standard for
Interchange File Format (EA IFF 1985). ILBM is a format to handle raster
images, specifically an InterLeaved bitplane BitMap image with color map.
It supports from 1 to 8-bit indexed images with HAM, Halfbride, and normal
encoding. It also supports interleaved 24-bit RGB and 32-bit RGBA
extension without color map.
- FORM ILBM 64: ILBM extension to support 48-bit RGB and 64-bit RGBA encoding.
- FORM ACBM (Amiga Contiguous BitMap): It supports uncompressed ACBMs by
converting them to ILBMs at runtime.
- FORM RGBN / RGB8: It supports 13-bit and 25-bit RGB images with compression
type 4.
- FORM PBM: PBM is a chunky version of IFF pictures. It supports 8-bit images
with color map only.
- FORM IMAG (Compact Disc-Interactive): It supports CLut4, CLut7, CLut8, Rle7
and DYuv formats.
- FORM RGFX: It supports uncompressed and ZIP compressed images.
- FORM DEEP: It supports uncompressed, RLE and TVDC images.
- FOR4 CIMG (Maya Image File Format): It supports 24/48-bit RGB and 32/64-bit
RGBA images.
> [!note]
> The plugin only supports the IFF, ILBM, and LBM file extensions. You'll
> need to rename files with different extensions to open them.
### The JP2 plugin
**This plugin can be disabled by setting `KIMAGEFORMATS_JP2` to `OFF`
@@ -323,6 +448,11 @@ JP2 plugin has the following limitations due to the lack of support by OpenJPEG:
- Image resolution is not supported.
- To write ICC profiles you need OpenJPEG V2.5.4 or higher
When writing, it is possible to set which format to use by setting the
following subtypes:
- `JP2` (default): Save data using the JP2 container.
- `J2K`: Save only the compressed codestream.
### The JXL plugin
**The current version of the plugin limits the image size to 256 megapixels
@@ -338,13 +468,23 @@ plugin:
### The JXR plugin
**This plugin is disabled by default. It can be enabled by settings
`KIMAGEFORMATS_JXR` to `ON` in your cmake options.**
`KIMAGEFORMATS_WITH_KNOWN_CRASHES_JXR` to `ON` in your cmake options.**
> [!caution]
> The plugin disabled by default due to security issues in [jxrlib](https://github.com/4creators/jxrlib):
> the upstream jxrlib is dead and there is no "hope" they will fix the issues.
>
> **You should not enable it unless you know what you are doing.**
> [!note]
> Security issues in the jxrlib discovered by the [KImageFormats OSS-Fuzz project](https://github.com/google/oss-fuzz/tree/master/projects/kimageformats)
> should be fixed in this [jxrlib fork](https://github.com/mircomir/jxrlib).
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
- `JXR_DISABLE_DEPTH_CONVERSION`: remove the needs 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
@@ -352,20 +492,11 @@ plugin:
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 and ORA 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
Both KRA and ORA formats are ZIP archives containing image data. Specifically,
the rendered PNG image is saved in the root directory: the plugin reads this
image.
### The PSD plugin
@@ -376,6 +507,8 @@ PSD support has the following limitations:
- 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.
- Grayscale images with alpha channel or at 32 bit depth are converted to
RGBA due to the lack of the appropriate Qt grayscale container.
- Extra channels other than alpha are discarded.
The following defines can be defined in cmake to modify the behavior of the
@@ -385,6 +518,13 @@ plugin:
- `PSD_NATIVE_CMYK_SUPPORT_DISABLED`: disable native support for CMYK images
when compiled with Qt 6.8+
The plugin can set the following additional metadata:
- `PSDDuotoneOptions`: Byte array in hexadecimal format of color data of the
duotone specification (the format of which is not documented). From the PSD
specification: *"Other applications that read Photoshop files can treat a
duotone image as a gray image, and just preserve the contents of the duotone
information when reading and writing the file."*
### The RAW plugin
Loading RAW images always requires a conversion. To allow the user to
@@ -395,6 +535,25 @@ 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 TGA plugin
TGA plugin supports both version 1 and version 2 of TGA files. When writing,
it is possible to force which version to use by setting the following subtypes:
- `TGAv1`: force TGA v1.0. No metadata.
- `TGAv2` (default): force TGA v2.0 (strict). Adds the TGA Extension Area.
- `TGAv2E`: force TGA v2.0 (enhanced). Same as TGA v2.0 (strict) but with the
addition of the TGA v2.0 Developer Area with info like, for e.g., Exif data,
XMP packet and the ICC profile.
They are all TGA specs compliant. While for versions 1 and 2 (strict) it is
possible to decode all the information with the TGA specification alone, for
version 2 (enhanced) it is necessary to know how the additional data is
encoded.
The following defines can be defined in cmake to modify the behavior of the
plugin:
- `TGA_V2E_AS_DEFAULT`: change the default version of the plugin to `TGAv2E`.
### The XCF plugin
XCF support has the following limitations:
+46 -18
View File
@@ -76,7 +76,9 @@ endmacro()
# Loads each <format> image in read/<format>/, and compares the
# result against the data read from the corresponding png file
kimageformats_read_tests(
ff
hdr
iff
pcx
pfm
psd
@@ -85,6 +87,7 @@ kimageformats_read_tests(
ras
rgb
sct
tim
tga
)
@@ -101,34 +104,59 @@ if (KF6Archive_FOUND)
endif()
if (TARGET avif)
kimageformats_read_tests(
avif
)
if(${libavif_VERSION} VERSION_GREATER_EQUAL "1.2.0")
kimageformats_read_tests(
avif
)
else()
message(WARNING "libavif ${libavif_VERSION} doesn't support decoding new AVIF files!\n"
"AVIF read tests are disabled, consider updating libavif.")
endif()
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
if (KIMAGEFORMATS_HEIC_TEST STREQUAL "ALL" OR KIMAGEFORMATS_HEIC_TEST STREQUAL "READ_ONLY")
kimageformats_read_tests(
heic
)
endif()
if (KIMAGEFORMATS_HEIC_TEST STREQUAL "ALL")
# because the plug-ins use RGB->YUV conversion which sometimes results in 1 value difference.
kimageformats_write_tests(FUZZ 1
heic-nodatacheck-lossless
)
endif()
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.19.0")
kimageformats_read_tests(FUZZ 4
avci
if (KIMAGEFORMATS_HEIF_TEST STREQUAL "ALL")
kimageformats_read_tests(
heif
)
endif()
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.17.0")
if (KIMAGEFORMATS_HEJ2_TEST STREQUAL "ALL" OR KIMAGEFORMATS_HEJ2_TEST STREQUAL "READ_ONLY")
kimageformats_read_tests(FUZZ 1
hej2
)
endif()
if (KIMAGEFORMATS_HEJ2_TEST STREQUAL "ALL")
kimageformats_write_tests(FUZZ 1
hej2-nodatacheck-lossless
)
endif()
endif()
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.19.6")
if (KIMAGEFORMATS_AVCI_TEST STREQUAL "ALL")
kimageformats_read_tests(FUZZ 4
avci
)
endif()
endif()
endif()
if (OpenJPEG_FOUND)
@@ -185,7 +213,7 @@ kimageformats_write_tests(
pic-lossless
qoi-lossless
rgb-lossless
tga # fixme: the alpha images appear not to be written properly
tga-nodatacheck
)
# EPS read tests depend on the vagaries of GhostScript
+264
View File
@@ -0,0 +1,264 @@
# 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, TIFF for image formats not supported by PNG (e.g. CMYK images) and,
as a last choice, lossy JPG for large images.
> [!important]
> Keep the size of individual test images on the order of a few tens of KiB.
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
(normally 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:
- `colorSpace` : Type `object`. An object with the `description` (type
`string`), `primaries` (type `string`), `transferFunction` (type `string`),
`colorModel` (type `string`) and `gamma` (type `double`) values of the
image color space.
- `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` (type `integer`)
and `dotsPerMeterY` (type `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.
- `skipSequential`: Type `boolean`. Skip the test on sequential access device.
Some plugins may have limited functionality on sequential devices (e.g.,
not reading metadata).
- `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)
- Example 6: [Color space](read/dds/rgba_f16.dds.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.
- `subType`: type `string`. The image writer subtype to set when testing.
[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 [ossfuzz](ossfuzz) directory.
## 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.
+1 -1
View File
@@ -48,7 +48,7 @@ private Q_SLOTS:
QCOMPARE(reader.text(QStringLiteral("Author")), QStringLiteral("KDE Community"));
}
void textRead()
void testRead()
{
QImageReader reader(QFINDTESTDATA("ani/test.ani"));
QVERIFY(reader.canRead());
+198
View File
@@ -0,0 +1,198 @@
#!/bin/bash -eu
#
# SPDX-FileCopyrightText: 2020 Google LLC
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
LDFLAGS=""
if [[ $FUZZING_ENGINE == "afl" ]]; then
LDFLAGS="-fuse-ld=lld"
fi
export LDFLAGS
# build zstd
cd $SRC/zstd
cmake -G Ninja -S build/cmake -DBUILD_SHARED_LIBS=OFF -DZSTD_BUILD_PROGRAMS=OFF -DBUILD_TESTING=OFF
ninja install
# Build zlib
cd $SRC/zlib
./configure --static
make install -j$(nproc)
# Build bzip2
# Inspired from ../bzip2/build
cd $SRC
tar xzf bzip2-*.tar.gz && rm -f bzip2-*.tar.gz
cd bzip2-*
SRCL=(blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o)
for source in ${SRCL[@]}; do
name=$(basename $source .o)
$CC $CFLAGS -c ${name}.c
done
rm -f libbz2.a
ar cq libbz2.a ${SRCL[@]}
cp -f bzlib.h /usr/local/include
cp -f libbz2.a /usr/local/lib
# Build xz
export ORIG_CFLAGS="${CFLAGS}"
export ORIG_CXXFLAGS="${CXXFLAGS}"
unset CFLAGS
unset CXXFLAGS
cd $SRC/xz
./autogen.sh --no-po4a --no-doxygen
./configure --enable-static --disable-debug --disable-shared --disable-xz --disable-xzdec --disable-lzmainfo
make install -j$(nproc)
export CFLAGS="${ORIG_CFLAGS}"
export CXXFLAGS="${ORIG_CXXFLAGS}"
# Build qt
cd $SRC/qtbase
./configure -no-glib -qt-libpng -qt-pcre -opensource -confirm-license -static -no-opengl -no-icu -platform linux-clang-libc++ -debug -prefix /usr -no-feature-widgets -no-feature-sql -no-feature-network -no-feature-xml -no-feature-dbus -no-feature-printsupport
cmake --build . --parallel $(nproc)
cmake --install .
# Build extra-cmake-modules
cd $SRC/extra-cmake-modules
cmake -G Ninja . -DBUILD_TESTING=OFF -DBUILD_DOC=OFF
ninja install
cd $SRC/karchive
rm -rf poqm
cmake -G Ninja . -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local
ninja install
# Build JXRlib
cd $SRC/jxrlib
make -j$(nproc)
# Build LibRaw
cd $SRC/LibRaw
TMP_CFLAGS=$CFLAGS
TMP_CXXFLAGS=$CXXFLAGS
CFLAGS="$CFLAGS -fno-sanitize=function,vptr"
CXXFLAGS="$CXXFLAGS -fno-sanitize=function,vptr"
autoreconf --install
./configure --disable-examples
make -j$(nproc)
make install -j$(nproc)
CFLAGS=$TMP_CFLAGS
CXXFLAGS=$TMP_CXXFLAGS
# Build aom
cd $SRC/aom
mkdir build.libavif
cd build.libavif
extra_libaom_flags='-DAOM_MAX_ALLOCABLE_MEMORY=536870912 -DDO_RANGE_CHECK_CLAMP=1'
cmake -G Ninja -DBUILD_SHARED_LIBS=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DCONFIG_PIC=1 -DAOM_TARGET_CPU=generic -DCONFIG_SIZE_LIMIT=1 -DDECODE_HEIGHT_LIMIT=12288 -DDECODE_WIDTH_LIMIT=12288 -DAOM_EXTRA_C_FLAGS="${extra_libaom_flags}" -DAOM_EXTRA_CXX_FLAGS="${extra_libaom_flags}" ..
ninja install
# Build libavif
cd $SRC/libavif
ln -s "$SRC/aom" "$SRC/libavif/ext/"
mkdir build
cd build
CFLAGS="$CFLAGS -fPIC" cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DAVIF_ENABLE_WERROR=OFF -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=OFF ..
ninja
# Build libde265
cd $SRC/libde265
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DENABLE_SDL=OFF -DENABLE_SIMD=OFF -DENABLE_AVX2=OFF -DENABLE_AVX512=OFF .
ninja install
# Build openjpeg
cd $SRC/openjpeg
mkdir build
cd build
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_CODEC=OFF ..
ninja install
# build openh264
cd $SRC/openh264
make USE_ASM=No BUILDTYPE=Debug install-static -j$(nproc)
# Build openexr
cd $SRC/openexr
mkdir _build
cd _build
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_TOOLS=OFF -DOPENEXR_BUILD_EXAMPLES=OFF -DOPENEXR_TEST_LIBRARIES=OFF -DOPENEXR_TEST_TOOLS=OFF -DOPENEXR_TEST_PYTHON=OFF ..
ninja install
# Build libjxl
cd $SRC/libjxl
mkdir build
cd build
CXXFLAGS="$CXXFLAGS -DHWY_COMPILE_ONLY_SCALAR" cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_DOXYGEN=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_ENABLE_JNI=OFF -DJPEGXL_ENABLE_MANPAGES=OFF -DJPEGXL_ENABLE_OPENEXR=OFF -DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_ENABLE_SKCMS=ON -DJPEGXL_ENABLE_TCMALLOC=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_FUZZERS=OFF ..
ninja install
# Build libheif
cd $SRC/libheif
#Reduce max width and height to avoid allocating too much memory
sed -i "s/static const int MAX_IMAGE_WIDTH = 32768;/static const int MAX_IMAGE_WIDTH = 8192;/g" libheif/security_limits.h
sed -i "s/static const int MAX_IMAGE_HEIGHT = 32768;/static const int MAX_IMAGE_HEIGHT = 8192;/g" libheif/security_limits.h
mkdir build
cd build
cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DENABLE_PLUGIN_LOADING=OFF -DWITH_EXAMPLES=OFF -DBUILD_DOCUMENTATION=OFF -DWITH_LIBSHARPYUV=OFF -DWITH_UNCOMPRESSED_CODEC=ON -DWITH_DAV1D=OFF -DWITH_EXAMPLES=OFF -DWITH_LIBDE265=ON -DWITH_RAV1E=OFF -DWITH_RAV1E_PLUGIN=OFF -DWITH_SvtEnc=OFF -DWITH_SvtEnc_PLUGIN=OFF -DWITH_X265=OFF -DWITH_X264=OFF -DWITH_OpenJPEG_DECODER=ON -DWITH_OpenH264_DECODER=ON ..
ninja install
cd $SRC/kimageformats
HANDLER_TYPES="ani
avif
dds
exr
ff
hdr
heif
iff
jp2
jxl
jxr
kra
pcx
pfm
pic
psd
pxr
qoi
ras
raw
rgb
sct
tim
tga
xcf"
echo "$HANDLER_TYPES" | while read format; do
(
fuzz_target_name=kimgio_${format}_fuzzer
/usr/libexec/moc $SRC/kimageformats/src/imageformats/$format.cpp -o $format.moc
header=`ls $SRC/kimageformats/src/imageformats/$format*.h`
/usr/libexec/moc $header -o moc_`basename $header .h`.cpp
$CXX $CXXFLAGS $LDFLAGS -fPIC -DKIMG_FUZZER_${format}=1 -std=c++17 autotests/ossfuzz/kimgio_fuzzer.cc $SRC/kimageformats/src/imageformats/$format.cpp $SRC/kimageformats/src/imageformats/scanlineconverter.cpp $SRC/kimageformats/src/imageformats/microexif.cpp $SRC/kimageformats/src/imageformats/chunks.cpp -o $OUT/$fuzz_target_name -DJXL_STATIC_DEFINE -DJXL_THREADS_STATIC_DEFINE -DJXL_CMS_STATIC_DEFINE -D__ANSI__ -I $SRC/kimageformats/src/imageformats/ -I $SRC/libavif/include/ -I $SRC/libjxl/build/lib/include/ -I $SRC/libjxl/lib/include/ -I /usr/local/include/OpenEXR/ -I /usr/local/include/KF6/KArchive/ -I /usr/local/include/openjpeg-2.5 -I /usr/local/include/Imath -I $SRC/jxrlib/common/include -I $SRC/jxrlib/jxrgluelib -I $SRC/jxrlib/image/sys -I /usr/include/QtCore/ -I /usr/include/QtGui/ -I . $SRC/libavif/build/libavif.a /usr/local/lib/libheif.a /usr/local/lib/libde265.a /usr/local/lib/libopenh264.a $SRC/aom/build.libavif/libaom.a $SRC/libjxl/build/lib/libjxl_threads.a $SRC/libjxl/build/lib/libjxl.a $SRC/libjxl/build/lib/libjxl_cms.a $SRC/libjxl/build/third_party/highway/libhwy.a $SRC/libjxl/build/third_party/brotli/libbrotlidec.a $SRC/libjxl/build/third_party/brotli/libbrotlienc.a $SRC/libjxl/build/third_party/brotli/libbrotlicommon.a -lQt6Gui -lQt6Core -lQt6BundledLibpng -lQt6BundledHarfbuzz -lm -lQt6BundledPcre2 -ldl -lpthread $LIB_FUZZING_ENGINE /usr/local/lib/libz.a /usr/local/lib/x86_64-linux-gnu/libKF6Archive.a /usr/local/lib/libz.a /usr/local/lib/libraw.a /usr/local/lib/libOpenEXR-3_4.a /usr/local/lib/libIex-3_4.a /usr/local/lib/libImath-3_2.a /usr/local/lib/libIlmThread-3_4.a /usr/local/lib/libOpenEXRCore-3_4.a /usr/local/lib/libOpenEXRUtil-3_4.a /usr/local/lib/libopenjp2.a /usr/local/lib/libzstd.a $SRC/jxrlib/build/libjxrglue.a $SRC/jxrlib/build/libjpegxr.a /usr/local/lib/liblzma.a /usr/local/lib/libbz2.a -lclang_rt.builtins
# -lclang_rt.builtins in the previous line is a temporary workaround to avoid a linker error "undefined reference to __truncsfhf2". Investigate why this is needed here, but not anywhere else, and possibly remove it.
find . -name "*.${format}" | zip -q $OUT/${fuzz_target_name}_seed_corpus.zip -@
)
done
# Manually add other supported extensions to HEIF seed corpus
find . -type f \( -name "*.avci" -o -name "*.heic" -o -name "*.hej2" \) | zip -q $OUT/kimgio_heif_fuzzer_seed_corpus.zip -@
+153
View File
@@ -0,0 +1,153 @@
/*
# SPDX-FileCopyrightText: 2018 Google Inc.
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
*/
/*
Usage:
python infra/helper.py build_image kimageformats
python infra/helper.py build_fuzzers --sanitizer undefined|address|memory kimageformats
python infra/helper.py run_fuzzer kimageformats kimgio_[ani|avif|dds|exr|ff|hdr|heif|iff|jp2|jxl|jxr|kra|pcx|pfm|pic|psd|pxr|qoi|ras|raw|rgb|sct|tim|tga|xcf]_fuzzer
*/
#include <QBuffer>
#include <QCoreApplication>
#include <QImage>
#include <QImageReader>
#if defined KIMG_FUZZER_ani
#include "ani_p.h"
#define HANDLER ANIHandler
#elif defined KIMG_FUZZER_avif
#include "avif_p.h"
#define HANDLER QAVIFHandler
#elif defined KIMG_FUZZER_dds
#include "dds_p.h"
#define HANDLER QDDSHandler
#elif defined KIMG_FUZZER_exr
#include "exr_p.h"
#define HANDLER EXRHandler
#elif defined KIMG_FUZZER_ff
#include "ff_p.h"
#define HANDLER FFHandler
#elif defined KIMG_FUZZER_hdr
#include "hdr_p.h"
#define HANDLER HDRHandler
#elif defined KIMG_FUZZER_heif
#include "heif_p.h"
#define HANDLER HEIFHandler
#elif defined KIMG_FUZZER_iff
#include "iff_p.h"
#define HANDLER IFFHandler
#elif defined KIMG_FUZZER_jp2
#include "jp2_p.h"
#define HANDLER JP2Handler
#elif defined KIMG_FUZZER_jxl
#include "jxl_p.h"
#define HANDLER QJpegXLHandler
#elif defined KIMG_FUZZER_jxr
#include "jxr_p.h"
#define HANDLER JXRHandler
#elif defined KIMG_FUZZER_kra
#include "kra_p.h"
#define HANDLER KraHandler
#elif defined KIMG_FUZZER_pcx
#include "pcx_p.h"
#define HANDLER PCXHandler
#elif defined KIMG_FUZZER_pfm
#include "pfm_p.h"
#define HANDLER PFMHandler
#elif defined KIMG_FUZZER_pic
#include "pic_p.h"
#define HANDLER SoftimagePICHandler
#elif defined KIMG_FUZZER_psd
#include "psd_p.h"
#define HANDLER PSDHandler
#elif defined KIMG_FUZZER_pxr
#include "pxr_p.h"
#define HANDLER PXRHandler
#elif defined KIMG_FUZZER_qoi
#include "qoi_p.h"
#define HANDLER QOIHandler
#elif defined KIMG_FUZZER_ras
#include "ras_p.h"
#define HANDLER RASHandler
#elif defined KIMG_FUZZER_raw
#include "raw_p.h"
#define HANDLER RAWHandler
#elif defined KIMG_FUZZER_rgb
#include "rgb_p.h"
#define HANDLER RGBHandler
#elif defined KIMG_FUZZER_sct
#include "sct_p.h"
#define HANDLER ScitexHandler
#elif defined KIMG_FUZZER_tim
#include "tim_p.h"
#define HANDLER TIMHandler
#elif defined KIMG_FUZZER_tga
#include "tga_p.h"
#define HANDLER TGAHandler
#elif defined KIMG_FUZZER_xcf
#include "xcf_p.h"
#define HANDLER XCFHandler
#else
#error "KIMG_FUZZER_format not defined!"
#endif
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
int argc = 0;
QCoreApplication a(argc, nullptr);
QImageReader::setAllocationLimit(512);
QImageIOHandler *handler = new HANDLER();
QImage i;
QBuffer b;
b.setData((const char *)data, size);
b.open(QIODevice::ReadOnly);
handler->setDevice(&b);
handler->canRead();
bool is_animated = false;
if (handler->supportsOption(QImageIOHandler::Animation)) {
is_animated = handler->option(QImageIOHandler::Animation).toBool();
}
if (is_animated) { // animated image
if (handler->supportsOption(QImageIOHandler::Size)) {
handler->option(QImageIOHandler::Size).toSize();
}
handler->imageCount();
handler->loopCount();
handler->read(&i);
handler->nextImageDelay();
handler->currentImageNumber();
handler->jumpToImage(0);
handler->jumpToNextImage();
} else { // static image
handler->read(&i);
}
delete handler;
return 0;
}
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash -eu
#
# SPDX-FileCopyrightText: 2018 Google Inc.
# SPDX-License-Identifier: Apache-2.0
#
# Based on https://github.com/google/oss-fuzz/blob/33aab4a70dc4b5811143d214536584a8c8cb3924/projects/kimageformats/Dockerfile
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
apt-get update && \
apt-get install -y cmake make autoconf automake autopoint libtool \
wget po4a ninja-build pkgconf
git clone --depth 1 https://github.com/madler/zlib.git
git clone --depth 1 -b v1.5.7 https://github.com/facebook/zstd.git
wget https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
git clone --depth 1 https://github.com/tukaani-project/xz.git
git clone --depth 1 --branch=RB-3.4 https://github.com/AcademySoftwareFoundation/openexr.git
git clone --depth 1 -b master https://invent.kde.org/frameworks/extra-cmake-modules.git
git clone --depth 1 --branch=dev git://code.qt.io/qt/qtbase.git
git clone --depth 1 --branch=dev git://code.qt.io/qt/qttools.git
git clone --depth 1 -b master https://invent.kde.org/frameworks/karchive.git
git clone --depth 1 -b v3.14.1 https://aomedia.googlesource.com/aom
git clone --depth 1 -b v1.4.2 https://github.com/AOMediaCodec/libavif.git
git clone --depth 1 https://github.com/strukturag/libde265.git
git clone --depth 1 -b v2.5.4 https://github.com/uclouvain/openjpeg.git
git clone --depth 1 https://github.com/strukturag/libheif.git
git clone --depth=1 --recursive --shallow-submodules https://github.com/libjxl/libjxl.git
git clone --depth 1 https://github.com/LibRaw/LibRaw
git clone --depth 1 https://github.com/mircomir/jxrlib.git
git clone --depth 1 -b v2.6.0 https://github.com/cisco/openh264.git
Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

@@ -0,0 +1,7 @@
[
{
"fileName": "invalid-exif.jpg",
"fuzziness": 30,
"description": "Minimum fuzziness value to pass the test on all architectures."
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "metadata.png",
"colorSpace" : {
"description" : "sRGB build-in",
"primaries" : "SRgb",
"transferFunction" : "SRgb",
"gamma" : 0
},
"metadata" : [
{
"key" : "ModificationDate",
Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

@@ -0,0 +1,11 @@
[
{
"fileName" : "profile_gray.png",
"colorSpace" : {
"colorModel" : "Gray",
"primaries" : "Custom",
"transferFunction" : "SRgb",
"gamma" : 2.31
}
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

@@ -0,0 +1,11 @@
[
{
"fileName" : "profile_gray_gamma22.png",
"colorSpace" : {
"colorModel" : "Gray",
"primaries" : "Custom",
"transferFunction" : "Gamma",
"gamma" : 2.2
}
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 KiB

@@ -0,0 +1,11 @@
[
{
"fileName" : "profile_gray_gamma28.png",
"colorSpace" : {
"colorModel" : "Gray",
"primaries" : "Custom",
"transferFunction" : "Gamma",
"gamma" : 2.8
}
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

@@ -0,0 +1,11 @@
[
{
"fileName" : "profile_gray_linear.png",
"colorSpace" : {
"colorModel" : "Gray",
"primaries" : "Custom",
"transferFunction" : "Linear",
"gamma" : 1
}
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

@@ -0,0 +1,12 @@
[
{
"fileName" : "profile_gray_prophoto.png",
"colorSpace" : {
"description" : "grayscale D50 with ProPhoto TRC",
"colorModel" : "Gray",
"primaries" : "Custom",
"transferFunction" : "Custom",
"gamma" : 0
}
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

+7 -1
View File
@@ -2,6 +2,12 @@
{
"fileName" : "rgba_f16.png",
"fuzziness" : 1,
"description" : "Minimum fuzziness value to pass the test on all architectures."
"description" : "Minimum fuzziness value to pass the test on all architectures.",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
}
}
]
Binary file not shown.
@@ -0,0 +1,15 @@
[
{
"fileName" : "ps2026_testcard_rgb.png",
"colorSpace" : {
"description" : "sRGB build-in (Profilo RGB lineare)",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"resolution" : {
"dotsPerMeterX" : 3937,
"dotsPerMeterY" : 3937
}
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "rgb-gimp.png",
"colorSpace" : {
"description" : "Embedded RGB (linear)",
"primaries" : "Custom",
"transferFunction" : "Linear",
"gamma" : 1
},
"resolution" : {
"dotsPerMeterX" : 3937,
"dotsPerMeterY" : 3937
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "Software" ,
+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "Software" ,
+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "Software" ,
+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "Software" ,
+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "Software" ,
+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "Software" ,
+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "Software" ,
+6
View File
@@ -1,6 +1,12 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "Linear sRGB",
"primaries" : "SRgb",
"transferFunction" : "Linear",
"gamma" : 1
},
"metadata" : [
{
"key" : "Software" ,
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
[
{
"fileName": "konqi.jpg",
"fuzziness": 72,
"description": "Minimum fuzziness value to pass the test on all architectures."
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

@@ -1,6 +1,12 @@
[
{
"fileName" : "metadata.png",
"colorSpace" : {
"description" : "sRGB build-in",
"primaries" : "SRgb",
"transferFunction" : "SRgb",
"gamma" : 0
},
"metadata" : [
{
"key" : "ModificationDate",

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.
@@ -0,0 +1,17 @@
[
{
"fileName" : "orientation_all.png",
"colorSpace" : {
"description" : "GIMP built-in sRGB",
"primaries" : "SRgb",
"transferFunction" : "SRgb",
"gamma" : 0
},
"metadata" : [
{
"key" : "Software" ,
"value" : "LIFE Pro 2.20.35 (Linux)"
}
]
}
]
Binary file not shown.
@@ -0,0 +1,11 @@
[
{
"fileName" : "orientation_all.png",
"metadata" : [
{
"key" : "Software" ,
"value" : "LIFE Pro 2.20.35 (Linux)"
}
]
}
]
Binary file not shown.
@@ -0,0 +1,11 @@
[
{
"fileName" : "orientation_all.png",
"metadata" : [
{
"key" : "Software" ,
"value" : "LIFE Pro 2.20.35 (Linux)"
}
]
}
]
Binary file not shown.
@@ -0,0 +1,11 @@
[
{
"fileName" : "orientation_all.png",
"metadata" : [
{
"key" : "Software" ,
"value" : "LIFE Pro 2.20.35 (Linux)"
}
]
}
]
Binary file not shown.
@@ -0,0 +1,11 @@
[
{
"fileName" : "orientation_all.png",
"metadata" : [
{
"key" : "Software" ,
"value" : "LIFE Pro 2.20.35 (Linux)"
}
]
}
]

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