Commit Graph

45 Commits

Author SHA1 Message Date
Daniel Novomeský
43c80793ac HEIF plug-in extended to support HEJ2 format
HEJ2 is JPEG 2000 codec encapsulated in HEIF container.
Only HEJ2 reading is implemented.
2023-12-07 12:58:14 +01:00
Mirco Miranda
b2b677b8a5 xcf: format v12 support (kf5)
The code is the same of MR !166 (master) but test cases are slightly different due to rounding.
2023-08-29 22:03:34 +00:00
Mirco Miranda
899a2df42d exr: multiple fixes (kf5)
The code is the same of MR !170 (master) but test cases are slightly different due to rounding.
* Support for images with transparency
* Precise colorspace conversion using QT color spaces
* Set the correct resolution
* Set useful metadata
* Creates 16-bits images
* Speed improvements
2023-08-28 17:29:34 +00:00
Mirco Miranda
274f30e008 qoi: fix buffer overflow kf5
Backport of MR !167:
- fix buffer overflow with corrupted images without image data
- fix unable to read very small images (e.g. 1x1 px)
- new test cases added
- detect incomplete files by checking the end of streams as written in the specs
2023-08-18 15:11:41 +00:00
Ernest Gupik
9438540735 Add support for the QOI image format
This MR adds read-only QOI (https://qoiformat.org/) image format support for KImageFormats.

This format has received it's MIME type inclusion in shared-mime-info 4 months ago: ff51a0a9e3

The code is based on the reference QOI implementation at https://github.com/phoboslab/qoi/blob/master/qoi.h

Official test images: https://qoiformat.org/qoi_test_images.zip

![pngvsqoi](/uploads/e386aa5057641057106e21940c770d97/pngvsqoi.png)

Also: This is my first MR to KDE ;)
(cherry picked from commit b209e54b6f)
2023-08-11 22:47:48 +02:00
Mirco Miranda
cf78907ff4 Set linear color space and round fix 2023-08-08 19:37:46 +00:00
Mirco Miranda
034b8f331b Treat 3-channel MCH images as CMY images
(cherry picked from commit 6559bf8994)
2023-07-03 23:26:50 +02:00
Mirco Miranda
64d51ed610 pcx: multiple fixes (2)
- 1-bit writer: checks where is black and use NOT operator only if needed
- Fix images with witdh == 65536(*)
- Checks result of disk writes and reads on all formats

(*) PCX formats support images with with of 65536 but only if the header field bytesPerLine is valid (no overflow). This means that the width 65536 is supported on 1bpp images only.
The previous version of the plugins wrote an image with width of 65536px in the wrong way and it was unable to read it (wrong image returned). I verified that Photoshop and Gimp weren't able to read the image either.

(cherry picked from commit d57ff91f8b)
2023-05-25 23:58:42 +02:00
Mirco Miranda
bb66367bc8 PCX: Fix reading of the extended palette
The VGA palette starts 769 bytes before the end of the file. There may be PADs between the end of the image and the start of the palette.

BUG: 463951
(cherry picked from commit 14742cb502)
2023-05-25 23:58:42 +02:00
Mirco Miranda
9b1fafe29b Fix wrong alpha conversion
and use tif for image comparison in this particular one instead of png

BUG: 468288
2023-04-12 20:34:33 +00:00
Mirco Miranda
e96b43aef5 psd: Fix alpha blending (KF5)
PSD files are saved with as alpha premultiplied. The problem is that alpha refers to white instead of black so it requires transformation formulas. Then, to conver PS premultiplied to QImage premultiplied you have to use the following formula:

* V = Alpha + Vps - Max (C, M, Y, K, R, G, B, Gray, L\* components)
* V = Vps + (Alpha - Max + 1) / 2 (a\*, b\* components)

Where Max is the maximum value depending on the image depth and Vps is the valued read from the file.

This is a port of MR !143 to KF5.
2023-03-29 17:58:09 +00:00
Mirco Miranda
2997f7ae8d psd: conversion speed improvements (kf5)
- Improved performance converting CMYK files by \~10% by replacing divisions with multiplications.
- Improved performance converting LAB files by \~50% by replacing std::pow with fastPow (approximated pow function).
2023-02-03 20:55:49 +00:00
Mirco Miranda
361f9e867e PSD multichannel testcases 2022-11-15 16:25:22 +00:00
Daniel Novomeský
bcbf45e23a Add JXL test files corresponding to 8 EXIF orientation values 2022-10-13 15:47:04 +02:00
Daniel Novomeský
c71a7984d6 Add AVIF test files with rotation and mirror operations 2022-10-12 15:39:27 +02:00
Mirco Miranda
54129819d5 Fix duplicated tests 2022-10-02 06:01:23 +00:00
Mirco Miranda
181eb253c6 ANI partial test and PIC test added 2022-10-02 06:01:23 +00:00
Mirco Miranda
524f083ee4 Added EXR test image 2022-10-02 06:01:23 +00:00
Mirco Miranda
c96ad6ba8a Fixes for sequential devices 2022-10-02 06:01:23 +00:00
Mirco Miranda
2f27dff48b Fix maximum number of channels (testcase added) 2022-09-22 21:17:10 +00:00
Mirco Miranda
65a20b43fc Camera RAW images plugin
Plugin to read RAW camera images based on LibRAW.

- Supersedes MR !86 
- Support to LibRaw 0.20 and 0.21-Beta
- Support to multi-shot images: use imageCount(), jumpToImage() to select the wanted shot
- By default generates 16-bits sRGB images using camera white balance and interpolation AHD
- Should fix CCBUG: 454208: on my Debian with KF5.96 and the pulgin installed, I see the preview of all my RAW files (ARW included) in Dolphin

News compared to V1 (MR !86)

- Fix possible stack overflow due to the huge size of LibRaw class
- Fix image allocation with Qt 6 (make use of QImageIOHandler::allocateImage()) 
- Support to XMP metapacket
- Support to quality option. For e.g. you can focus on quality (q = 10) or speed (q = 1)
- oss-fuzz available [here](https://github.com/mircomir/oss-fuzz/tree/raw_fuzz/projects/kimageformats)
2022-09-19 23:52:43 +00:00
Mirco Miranda
6f44c5c52a PSD: Improve alpha detection
BUG: 182496
2022-07-25 19:34:57 +00:00
Mirco Miranda
d030c75925 PSD: LAB support
LAB images support:
- Added LAB 8/16-bits support by converting them to sRGB
- The conversion are done using literature formulas (LAB -> XYZ -> sRGB): [sRGB on Wiki](https://en.wikipedia.org/wiki/SRGB), [LAB on wiki](https://en.wikipedia.org/wiki/CIELAB_color_space)
- Removed unused code
2022-07-06 21:30:23 +00:00
Mirco Miranda
c52ffa2227 Fix Alpha + testcase images 2022-06-30 06:56:21 +00:00
Mirco Miranda
44fd6b7bc0 psd: duotone read
- New format added: Duotone
- Fix float to int conversion round issue
2022-04-11 21:07:23 +00:00
Mirco Miranda
98f19c60ae PSD: Performance improvements and support to missing common formats
- Supersedes merge request !55 (PSB support, XMP metadata, ICC color profile, image resolution read)
- Performance improvements: 5 time faster than previous version (tested on a 3.9GB PSB: 9sec instead 47sec)
- New formats support added: INDEXED (8bps), BITMAP (1bps), GRAYSCALE (8, 16, 32bps), RGB (32bps)
- Should fix Bug https://bugs.kde.org/show_bug.cgi?id=397610
- Fix Bug https://bugs.kde.org/show_bug.cgi?id=428238
2022-04-04 17:22:45 +00:00
Mirco Miranda
3e751dd80d Fix XCF parasites metadata in QImage and support to ICC profile
- Fix parasite "gimp-comment" not set due to null QImage
- Support to parasite "icc-profile" using Qt 5.14+ API
- Added parasite "gimp-image-metadata" as QImage metadata "XML:org.gimp.xml"
- Added a XCF with XML metadata and icc prifile embedded in autotest folder (generated by GIMP 2.10.30)
- Tested with Qt 5.15.2 and Qt 6.2.3 under Windows and Qt 6.2.3 under macOS
2022-03-23 23:34:33 +00:00
Daniel Novomesky
41c4b5930c Add plugin for JPEG XL (JXL) 2021-11-10 16:01:58 +01:00
Fred Fonkle
503b3eee2b Fix Non-square Radiance/RGBE/.hdr images failing to load
The HDR QImageIOHandler plugin only supports the default image orientation (-Y +X) in .hdr files. It mixes up the width and height however, resulting in non-square images not loading.

This fix adds a check for the standard image orientation in the file and returns false (with error message) if that fails.
If it succeeds, it takes the height from the -Y component, and the width from the +X component, resulting in successful loading of the image.

Add autotest images for landscape and portrait HDR (Radiance RGBE) loader

BUGS: 433877
2021-03-04 22:57:23 +01:00
Daniel Novomesky
ca52d4ddf5 Add plugin for High Efficiency Image File Format (HEIF)
Code partially by Sirius Bakke
2021-02-25 11:52:00 +01:00
Daniel Novomeský
34a9ec1b06 Add plugin for AV1 Image File Format (AVIF) 2020-12-13 22:23:27 +00:00
Gary Wang
938b8126b5 No longer descease color depth to 8 for 16 bit uncompressed PSD files 2020-11-10 13:03:37 +08:00
Chris Xiong
f2ccbf1724 Add test case for RLE compressed 16 bpc PSD files. 2020-11-06 15:04:04 +08:00
Gary Wang
b742cb7cc7 Return unsupported when reading 16bit RLE compressed PSD files 2020-11-01 11:50:48 +08:00
Martin T. H. Sandsmark
c60e77c048 Add support for modern Gimp images/XCF files
We now support up to and including version 11 of the XCF format, earlier
it only supported version 1 (from 1997, according to the XCF spec).

Biggest difference seems to be that they changed to 64bit for offsets
from version 11 and upwards, otherwise it's mostly just newer enum
values and theoretically major stuff that we don't really need to care
about to get a thumbnail (e. g. linear vs. perceptual RGB).

We still don't support all features, but now it handles that more
gracefully and should at least create thumbnails that are usable. It
should also be easier to update in the future if/when there comes new
versions.

Also added a test file created with the latest version of Gimp
(2.10.18).

Reviewed By: aacid

Differential Revision: https://phabricator.kde.org/D25937
2020-04-13 14:52:33 +02:00
Albert Astals Cid
bf5502403e Add files for testing bug411327 2019-09-20 23:18:17 +02:00
Christoph Feck
68bb1a0ee7 Port HDR (Radiance RGBE) image loader to Qt5
Tested with HDR images from hdrihaven.com
* Loading in KolourPaint works
* Thumbnails in Dolphin work

Reviewed by: aacid

Differential Revision: https://phabricator.kde.org/D23811
2019-09-14 14:05:30 +02:00
Albert Astals Cid
10f201e414 Use gimp to export simple-rgba-gimp-2.8.10.xcf to png again
This fixes the xcf test that was failing, i guess at some point someone
run optipng or something over the expected result and that was causing
the test to fail
2018-11-17 12:22:25 +01:00
Boudewijn Rempt
6934d54417 Add kra and ora imageio plugins (read-only)
kra is the native format for Krita and ora the interchange format
for krita, gimp and mypaint (it's also mypaint's native format).
Both formats are simply zip containers with an embedded png.

REVIEW:126675
2016-01-31 15:01:32 +01:00
Heiko Becker
e5fce91de6 Remove DDS and JPEG-2000 plugins
They were already disabled when building with Qt >= 5.3 in commit
3d45b270ea because Qt has better plugins
for those image formats. Now that we depend on Qt 5.3 we can remove
them.

REVIEW: 124636
2015-08-06 00:57:14 +02:00
Alex Merry
51eca9b6a8 Rewrite the PIC image format handler
It now uses QDataStream to deal with endianness. It also supports
several QImageIOHandler options.

This comes with a more comprehensive test suite than the old code. Note
that the old test suite was incorrect as the old code wrote the floats
in the header out incorrectly (although no-one noticed because no
software seems to care about those values).

All the test PIC files in the test suite appear correct according to the
specification (by inspection with Okteta). Unfortunately, there is a
lack of other freely-available software that reads and writes PIC files
(the main application that uses them is proprietary), and so this is the
best I can do.

REVIEW: 117944
2014-05-04 13:42:30 +01:00
Alex Merry
6375160828 Remove the WebP format
This will be in Qt 5.3.

REVIEW: 116026
2014-02-25 12:16:34 +00:00
Alex Merry
7177296335 Import the WebP image I/O code from kde-runtime
The plugin export mechanism has been patched up (including the addition
of the JSON file), and the FindWebP.cmake file is new.

Writing is currently disabled, as it produces broken images.

Autotests are generated using the cwebp and dwebp utilities distributed
with the libwebp reference library.

REVIEW: 115355
2014-02-20 12:56:00 +00:00
Alex Merry
3eafdc861a Remove the xv image format plugin
It appears to be some internal format of xview, although I cannot find
any mention of such a thing on the internet.  There does not appear to
be any sort of mime type to associate with this file format, either.

Therefore, I think it is reasonable to declare it obsolete.

REVIEW: 115768
2014-02-15 18:47:06 +00:00
Alex Merry
f0f6d14367 Add simple autotests
Two main tests: read the file and compare to a given image (loaded from
png), and write a file out and compare to a previously-written image.

The write test in particular is kind of fragile, but it should help
catch some errors where a code change was not intended to affect the
output of the plugin.

Tests are included for all the writable formats, as well as every
readable format that GIMP can write to (and so I could easily get an
example of).

REVIEW: 115430
2014-02-03 15:03:29 +00:00