Commit Graph

686 Commits

Author SHA1 Message Date
Daniel Novomeský
da8ed31aec avif: new quality settings
Prior libavif 1.0, quality was set using two numbers
(minQuantizer and maxQuantizer).
New versions of libavif recommend using
new/single quality parameter instead.
Compression using the new settings is different
compared to the old.
For example, new quality 68 gives similar compression
like old default 52.
2023-12-13 17:40:21 +01:00
Daniel Novomeský
ce8383e5fd 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 13:26:43 +01:00
Laurent Montel
db0adee62f GIT_SILENT: Port to new CI template 2023-11-20 07:14:46 +01:00
Volker Krause
91a342e90d Cleanup pre-Qt 6.5 code 2023-11-19 14:14:36 +01:00
Laurent Montel
7864ad4bc6 There's no QVector anymore, QList is the QVector in Qt6 2023-10-20 07:10:28 +02:00
Nicolas Fella
524711f633 Add missing license texts
BUG: 475299
2023-10-07 00:00:52 +02:00
Daniel Novomeský
b8b980f400 avif: support repetition count
and minor performance optimizations.
2023-10-06 13:03:28 +02:00
Mirco Miranda
d932e0d16b Multi-image, same behavior as the TIFF plugin 2023-09-25 23:02:37 +02:00
Mirco Miranda
18ea0492bc raw: fix multi image load
Fixes not loading a second image in the file. This patch allow code like the following.

QImageReader r(file);
do {
    auto qi = r.read();
    if (!qi.isNull()) {
        qi.save(QString("/tmp/%1_%2.tif")
                .arg(QFileInfo(file).baseName())
                .arg(r.currentImageNumber()));
    }
}
while (r.jumpToNextImage());

m_startPos is used to reposition the device if you decide to do a subsequent read: libraw wants it to be at the beginning of the RAW stream
2023-09-25 20:55:53 +00:00
Mirco Miranda
7899c27a80 exr: write support and more
- Added support for writing EXR files
- Large image support (tested with 32GiB 16-bit image)
- OpenEXR multithreaded read/write support through the use of line blocks
- Build option to enable conversion to sRGB when read (disabled by default)
- Multi-view image reading support
- Options support: Size, ImageFormat, Quality, CompressRatio
- Metadata write/read support via EXR attributes

The plugin is now quite complete. It should also work on KF5 (not tested): if there is the will to include this MR also on KF5, let me know and I will do all the necessary tests.
2023-09-17 08:07:47 +00:00
Laurent Montel
6a51407556 Remove unused Qt5 code 2023-09-15 13:29:13 +02:00
Mirco Miranda
75e1280073 hdr: options support and bugfixes
- Support for Size and Format options
- Added compile option to generate 16-bit instead of 32-bit images
- Includes MR !189 and MR !192 fixes
2023-09-11 09:08:18 +00:00
Mirco Miranda
0a6fbd88e9 xcf: fix crash (oss-fuzz issue 62075) 2023-09-07 16:12:41 +00:00
Mirco Miranda
fbf60f8bbb xcf: fix possible overflow
Port to KF6 of MR !187
2023-09-05 11:32:32 +00:00
Heiko Becker
2799382c21 Drop code for Qt < 6.5.0
...now that we depend on Qt >= 6.5.0.
2023-08-30 00:27:47 +02:00
Heiko Becker
adc7da4f41 GIT_SILENT Upgrade Qt6 version requirement to 6.5.0. 2023-08-29 23:31:26 +02:00
Daniel Novomeský
ac808679cd qoi: initialize structure before use
It was reported by Code Quality scans as Critical (CWE-457)
2023-08-29 21:04:00 +02:00
Daniel Novomeský
2aea982e9e qoi: fix reports from quality scanner
struct QoiHeader is initialized to invalid values prior use,
it’s good to detect situations when we read incomplete data.
Add include in scanlineconverter.cpp so it can be used without
change in kf5 branch.
2023-08-29 16:22:52 +02:00
Mirco Miranda
9173f02ea3 ras: rle decode
Added support for RLE compressed images. This patch makes the player almost complete allowing to read all type 1,2 and 3 RAS files. Only types 4 and 5 are missing which are images converted from TIFF and IFF.
2023-08-29 09:11:35 +00:00
Antonio Rojas
4badb3088e Support libavif 1.0
Make cmake find libavif 1.0 and adapt to API changes (which is reverting to pre 0.9.2 API)
2023-08-29 09:21:37 +02:00
Mirco Miranda
8dc685df26 qoi: write support
As a base I used the reference implementation found on the official site at https://qoiformat.org/ (MIT license).
I added a class to convert scan lines in scanlineconverter.cpp. The class takes advantage of the QImage conversion and contrary to what one might expect, with large images it improves performance (compared to converting the whole image) 😄 

In progressive mode, for each line, the following conversions (only if needed) are made before saving:
1. If the icc profile is set, the line is converted to sRGB or sRGB Linear.
2. The line is scaled to 8 bits with RGBA order.
2023-08-28 22:25:10 +00:00
Friedrich W. H. Kossebau
4bd9d5baec No longer needed to explicitly include CMakeParseArguments
NO_CHANGELOG
2023-08-28 22:54:41 +02:00
Mirco Miranda
79e8e183eb ras: code revamped
- Progressive load from file
- Added support for 1-bit image
- Images with palette are now Index (instead of RGB32)
- Added options support (Size, Format)
- Added some test cases
- Improved performance by directly accessing the scanline
- Support for more RAS extension (taken from GIMP)

The code should works "as is" also on KF5.
2023-08-28 18:02:02 +00:00
Mirco Miranda
7d63a1d8fa exr: multiple fixes
- Support for images with transparency
- Precise colorspace conversion using QT color spaces
- Set the correct resolution
- Set useful metadata
- Support for RGBX16FPx4 format in Qt 6
- Speed improvements

![image](/uploads/bb36492d71acce4995e8b4229a813031/image.png)
2023-08-28 17:30:50 +00:00
Mirco Miranda
c11c5eff4f xcf: format v12 support
This is a patch over MR !108 by @sandsmark. Martin has done a great job implementing support and I find it a shame not to use it.

I made sure that the results are the same as the current version and fixed the problems of pixels with wrong colors with color depth grater than 8 bits. I also fixed conversion errors on mask and gray images (16/32 bits).
Unfortunately the internal rendering engine of the original code is 8-bit so I always forced the output of 8-bit images to correct the problems (see image below). Since it is a plugin with a "rendering engine", the tests to seriously validate it are potentially endless (as the original version is not perfect).

Errors of the original version of the MR (right) which should no longer occur:
![image](/uploads/9ef24eb5436bd19ff1fb428242a9c119/image.png)
2023-08-28 17:27:08 +00:00
Mirco Miranda
c02bf3dbcc Readme.md: Update supported formats list
- (+) Krita (kra)
- (+) OpenRaster (ora)
- (-) XView (xv)
2023-08-20 08:04:21 +00:00
Mirco Miranda
6254529d2d qoi: fix buffer overflow
- 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 14:09:00 +00:00
Mirco Miranda
35ff3efbbc hdr: improve precision
- Improve the precision of HDR format (it is a floating point format) by using the RGBA32FPx4 image format.
2023-08-13 22:19:22 +00:00
Mirco Miranda
7a0d95af92 Renamed qoi.h to qoi_p.h 2023-08-12 23:47:29 +02:00
Mirco Miranda
4c3ade04dd Minor improvements 2023-08-12 09:03:56 +02:00
Ernest Gupik
b209e54b6f 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 ;)
2023-08-11 20:44:17 +00:00
Mirco Miranda
4dc2099fa4 Set linear color space for proper viewing 2023-07-21 14:17:11 +02:00
Mirco Miranda
491b223c15 psd: Fix UB type punning
BUGS: 471829
2023-07-16 08:07:13 +00:00
Mirco Miranda
6559bf8994 Treat 3-channel MCH images as CMY images 2023-07-03 12:34:54 +02:00
Friedrich W. H. Kossebau
34ed3bad27 Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-02 03:08:44 +02:00
Daniel Novomeský
9c579fc1f8 jxl: add support for libjxl v0.9, drop support for old 0.6.1 2023-06-27 14:32:08 +02:00
Mirco Miranda
93adb22632 raw: change the use of the quality parameter
- Standardized the quality parameter between 0-100
- The value -1 is the default value of Qt plugins and is managed
- Negative values other than -1 are used as flags to activate the custom mode
2023-05-17 17:45:23 +00:00
Mirco Miranda
d57ff91f8b 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.
2023-05-12 08:53:50 +00:00
Mirco Miranda
edd6adcbac Avoid unnecessary conversions 2023-05-10 15:34:14 +02:00
Mirco Miranda
d787c12727 RGB/SGI writer: fix alpha detection and image limit size 2023-05-10 11:43:21 +00:00
Mirco Miranda
c9fec5e408 TGA writer: fix alpha detection and performance improvements 2023-05-10 11:43:21 +00:00
Mirco Miranda
e60dfd4968 pcx: multiple fixes
- Fix wrong RGB channel order if image format is other than (A)RGB32
- Write right resolution
- Set right resolution on image load
- Return false on write error
- Save images with depth greater than 24-bits
2023-05-10 11:43:04 +00:00
Mirco Miranda
f5a9dd46d2 Removed unused jxl.desktop file 2023-04-22 09:31:30 +02:00
Mirco Miranda
41f0411b62 PSD: fix test failure on some systems and fix wrong check on alpha conversion
- Fix PSD alpha conversion
- Fix autoread test to use also TIFF images
2023-04-18 22:14:41 +00:00
Gary Wang
e1a3751936 CMake: make use of qt_add_plugin for plugins
Currently it will only produce shared library binaries as plugin.
This could make building static imageformats plugin much easier.

Related: https://invent.kde.org/frameworks/kimageformats/-/issues/4
2023-03-30 03:42:41 +00:00
Mirco Miranda
402dfb5de3 psd: Fix alpha blending
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.
2023-03-29 17:55:55 +00:00
Éric Gillet
a3f7c03b61 heif: Add format read-write support in README 2023-02-15 08:36:24 +00:00
Freya Lupen
20cec27ae8 Fix writing TGA alpha depth flag
Correctly write alpha channel depth as 8-bit.
2023-02-01 16:26:31 -06:00
Volker Krause
d34c1668aa Bump Qt deprecation level to 6.4 2023-02-01 17:16:45 +01:00
Mirco Miranda
560d0483ae Replace deprecated functions
Improve the code by replacing deprecated functions as suggested by the Qt documentation.
2023-01-31 21:32:30 +00:00