Commit Graph

771 Commits

Author SHA1 Message Date
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
14286a6ab0 Add a CI job for oss-fuzz 2025-09-13 10:15:10 +00:00
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
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
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
56c8bc7323 Add checks on the seek return value 2025-09-09 22:20:34 +02:00
08e178f098 Fix Null-dereference READ 2025-09-09 21:15:19 +02:00
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
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
8036b1d032 Fix assert when read corrupted floats 2025-09-08 11:01:06 +02:00
71cc137254 Update version to 6.19.0 2025-09-08 10:23:10 +02:00
7858c4eeec Update dependency version to 6.18.0 v6.18.0-rc1 v6.18.0 2025-09-07 14:25:38 +02:00
eae41980b2 dds: Fix assert when reading broken data
oss-fuzz testcase 6027629841154048
2025-09-06 22:39:16 +00:00
3bf2281610 GIT_SILENT: Use Qt CamelCase includes 2025-09-04 08:32:52 +02:00
59089855fa Unified maximum pixel value for large image plugins 2025-08-30 09:17:58 +02:00
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
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
f933cbe12d Fix possible buffer overflow on corrupted images 2025-08-22 08:08:17 +02:00
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
bc8b5b56b1 Move fuzz target and build script into KImageFormats repository 2025-08-20 22:57:06 +05:30
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
f63b082c85 IFF: add support for a different palette per line 2025-08-12 08:28:31 +02:00
68cc915132 IFF: Fix possible undefined-shift 2025-08-09 11:46:05 +02:00
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
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
37e3c65a05 ILBM 64-bit extension support 2025-08-04 13:47:00 +02:00
4b44f8474f Fix oss-fuzz compilation error 2025-08-04 13:46:16 +02:00
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
cd39c36621 Update version to 6.18.0 2025-08-01 13:33:36 +02:00
1bfae6f171 Update dependency version to 6.17.0 v6.17.0-rc1 v6.17.0 2025-08-01 12:14:50 +02:00
fd864e6f55 IFF: add support for uncompressed ACBM type 2025-07-24 07:37:58 +02:00
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
457f3afa24 Fix CI
GIT_SILENT
2025-07-20 21:43:36 +00:00
080fd3c72d It compiles fine without qt 6.10 deprecated methods 2025-07-20 21:42:04 +02:00
1d69f6af57 IFF: add mime types and extensions 2025-07-17 07:32:26 +02:00
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
0a9f9fe106 IFF: support for Ham8, HalfBride, Pbm and ILBM 32-bits modes 2025-07-15 07:38:19 +02:00
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
aef4bd7e1c Fix unused param in MicroExif::toByteArray() 2025-07-07 08:17:36 +02:00
ea1983a7d1 IFF: Fix possible stack overflow 2025-07-05 09:59:06 +00:00
775b53f1f6 Update version to 6.17.0 2025-07-04 18:28:45 +02:00
02cf1502c0 Update dependency version to 6.16.0 v6.16.0-rc1 2025-07-04 16:29:08 +02:00
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
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
e6357c22f7 tga: Use Format_Indexed8 for indexed formats and support 32-bit BGRA colormap 2025-06-26 16:00:11 +02:00
094177a01c Update version to 6.16.0 2025-06-06 16:31:26 +02:00
7420f47c17 Update dependency version to 6.15.0 v6.15.0 v6.15.0-rc1 2025-06-06 15:19:44 +02:00
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
e3aefd2aa1 JXR: Restore device position after reading options 2025-05-14 02:50:03 +02:00
aa8134ee0d README.md: minor fixes and improvements 2025-05-06 07:33:27 +02:00