Bug 441673 - Build qt5-image-formats-plugins with JP2 support
Summary: Build qt5-image-formats-plugins with JP2 support
Status: RESOLVED FIXED
Alias: None
Product: neon
Classification: KDE Neon
Component: Packages User Edition (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Neon Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-28 19:50 UTC by geisserml
Modified: 2021-08-31 11:43 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Example JP2 image (30.29 KB, image/jp2)
2021-08-28 19:50 UTC, geisserml
Details

Note You need to log in before you can comment on or make changes to this bug.
Description geisserml 2021-08-28 19:50:27 UTC
Created attachment 141108 [details]
Example JP2 image

SUMMARY
Images that are reported as "JPEG-2000 JP2" (".jp2" file extension) do not open with Gwenview (nor is there a preview in Dolphin). GIMP is able to open JP2 files, though.

STEPS TO REPRODUCE
1. Obtain a JP2 image (e. g. the attached one)
2. Try opening it with Gwenview

OBSERVED RESULT
Opening the image fails (type not supported).

EXPECTED RESULT
Gwenview should be able to display JP2 images.

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-27-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-3570K CPU @ 3.40GHz
Memory: 7.2 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4000

ADDITIONAL INFORMATION
Apparently this issue already happened once back in 2009 and got fixed (Bug 183903). In the same year, a report had been filed for Krita (Bug 208578), which is marked as fixed. However, Krita currently is not able to open JP2 files either.
Comment 1 2wxsy58236r3 2021-08-29 10:11:43 UTC
It works for me though on Arch Linux - Dolphin shows preview for the test file and Gwenview can open and display it fine.

Do you have jasper and qt5-imageformats installed?
Comment 2 2wxsy58236r3 2021-08-29 10:14:03 UTC
P.S. to my last comment:

I have jasper, openjpeg2 and qt5-imageformats installed and it works for me.
Comment 3 geisserml 2021-08-29 11:19:17 UTC
qt5-imageformats and libopenjp2-7 are both installed
jasper has nothing to do with JP2 images, it's a package for configuring ext2/3.
Comment 4 geisserml 2021-08-29 11:28:35 UTC
> It works for me though on Arch Linux
If it works on Arch, then maybe we should move the issue to Neon User issues?
Comment 5 geisserml 2021-08-29 13:13:38 UTC
The Krita issue just got fixed (see https://invent.kde.org/graphics/krita/-/commit/542dcd306e236ec776a81e389d0a601387739e48)
Maybe the cause is similar for Gwenview and Dolphin?
Comment 6 2wxsy58236r3 2021-08-30 00:14:51 UTC
(In reply to Manuel Geißer from comment #3)
> qt5-imageformats and libopenjp2-7 are both installed
> jasper has nothing to do with JP2 images, it's a package for configuring
> ext2/3.

I am referring to https://github.com/jasper-software/jasper (https://www.ece.uvic.ca/~frodo/jasper/).
On Arch Linux, qt5-imageformats depends on jasper.
Comment 7 2wxsy58236r3 2021-08-30 00:31:43 UTC
It looks like many distros have dropped jasper, but in the end Arch Linux still keeps it because the upstream jasper repo eventually merged the security and maintenance fixes. [1]

Meanwhile, from [2] I guess Qt may still rely on jasper for JP2 support.

I think you can try checking whether your system has libqjp2.so, such as searching in `/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/`.
If it cannot be found then maybe qt5-imageformats is built without JP2 support.

[1] https://bugs.archlinux.org/task/64655
[2] https://github.com/qt/qtimageformats/blob/dev/src/plugins/imageformats/jp2/qjp2handler.cpp
Comment 8 geisserml 2021-08-30 11:23:06 UTC
Thanks for these very helpful hints. Indeed, KDE Neon seem to have built qt5-image-formats-plugins without JP2 support. libqjp2.so is not present in the plugins directory.
The image-related JasPer is not in Ubuntu/Neon, instead only [this jasper package](https://packages.ubuntu.com/focal/jasper), which had confused me first.
Comment 9 geisserml 2021-08-30 20:19:11 UTC
What exactly are the concerns about JasPer? As of 2021, it is actively maintained by the original author Michael Adams. There have been 8 releases this year, and the previous week's git history is full of commits. And JasPer seems to be fairly popular, too.
Comment 10 2wxsy58236r3 2021-08-31 00:56:53 UTC
I believe it is now actively maintained so I also hope that other distros can include JasPer again.

See also:
https://github.com/jasper-software/jasper/issues/208#issuecomment-665471904
Comment 11 Jonathan Riddell 2021-08-31 10:34:56 UTC
Removed in Debian in 2016 due to security fears
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818209

I've now added an update of jasper into neon
https://build.neon.kde.org/view/1%20release%20%E2%9B%B0/job/focal_release_forks_jasper/
and rebuild qimageformats
https://build.neon.kde.org/view/3%20unstable%20%E2%98%A3%20git%20master/job/focal_unstable_qt_qtimageformats/

And gwenview seems to show the attached file

Mind you this is the first time in 20 years I've ever come across anyone using jpeg2000 :)
Comment 12 geisserml 2021-08-31 10:37:09 UTC
Whoah, that was quick. Thank you!
Comment 13 geisserml 2021-08-31 11:43:06 UTC
I just installed the two packages. Works perfectly in Gwenview and Dolphin now :)