Bug 434888 - Add support for AVIF images
Summary: Add support for AVIF images
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: Image backend components (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-24 15:02 UTC by Lonnie
Modified: 2021-03-25 23:12 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lonnie 2021-03-24 15:02:26 UTC
Okular doesn't allow your to open avif images. Please add support.

AVIF Support in Web Browsers:
https://caniuse.com/avif

AVIF Has Arrived:
https://jakearchibald.com/2020/avif-has-landed/
Comment 1 Luigi Toscano 2021-03-24 15:12:13 UTC
This is not on Okular, whose mage backend just use the Qt function to open files. The support for additional formats can be provided by plugins, and some more formats are supported by the kimageformats library, which is part of KDE Frameworks:
https://invent.kde.org/frameworks/kimageformats/

In fact support for AVIF was added a few months ago, it should be available in the latest Frameworks releases:
https://invent.kde.org/frameworks/kimageformats/-/merge_requests/8

https://kde.org/announcements/frameworks/5/5.78.0/

I'm thus closing this bug; please reopen it if it doesn't work with Frameworks >= 5.78.0.
Comment 2 Luigi Toscano 2021-03-24 15:14:51 UTC

*** This bug has been marked as a duplicate of bug 416941 ***
Comment 3 Luigi Toscano 2021-03-24 15:20:24 UTC
Actually, we may need to tell the kimgio backend that it can open that format. Sigh.
Comment 4 dnovomesky 2021-03-24 15:51:37 UTC
Yes, just to add image/avif to few files in
https://invent.kde.org/graphics/okular/-/tree/master/generators/kimgio

and it will work.
Comment 5 Luigi Toscano 2021-03-24 15:55:44 UTC
(In reply to dnovomesky from comment #4)
> Yes, just to add image/avif to few files in
> https://invent.kde.org/graphics/okular/-/tree/master/generators/kimgio
> 
> and it will work.

It should be done in a way that doesn't break horribly if kimageformats is not available or not fresh enough.
Comment 6 Lonnie 2021-03-24 16:04:58 UTC
In Okular, using the open-file dialog, if you navigate to a folder that contains avif or webp images, the file selection dialog will not even list those file-types without the additional step of changing the filter from "All supported files" to "All files".

Screenshot:
https://i.imgur.com/wwVUuEU.png
Comment 7 Yuri Chornoivan 2021-03-24 16:30:06 UTC
(In reply to Lonnie from comment #6)
> In Okular, using the open-file dialog, if you navigate to a folder that
> contains avif or webp images, the file selection dialog will not even list
> those file-types without the additional step of changing the filter from
> "All supported files" to "All files".
> 
> Screenshot:
> https://i.imgur.com/wwVUuEU.png

This is the easiest part of the problem that can be fixed by tweaking MimeType in the kimgio ".desktop" files. You can even add the type ("image/webp") in your system without recompiling Okular.
Comment 8 dnovomesky 2021-03-24 16:44:40 UTC
(In reply to Luigi Toscano from comment #5)
> (In reply to dnovomesky from comment #4)
> > Yes, just to add image/avif to few files in
> > https://invent.kde.org/graphics/okular/-/tree/master/generators/kimgio
> > 
> > and it will work.
> 
> It should be done in a way that doesn't break horribly if kimageformats is
> not available or not fresh enough.

I made an experiment.
I edited those files.
Then I removed kimg_avif.so
AVIF is still listed as supported but opening an AVIF file will fail with message "Unsupported image format"
That's not a horrible breakage I think.
Comment 9 Lonnie 2021-03-24 16:45:24 UTC
Will do. Likewise, I hope development makes these additional steps unnecessary for others. Thank you.
Comment 10 Nate Graham 2021-03-24 18:57:35 UTC
So are you going to submit a merge request? That would be nice. :)
Comment 11 Bug Janitor Service 2021-03-24 22:49:11 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/386
Comment 12 Albert Astals Cid 2021-03-25 23:12:20 UTC
Git commit c38af3e695be5e0cd59732effdc5bb7d63a67951 by Albert Astals Cid.
Committed on 24/03/2021 at 22:42.
Pushed by aacid into branch 'release/21.04'.

Add a few more formats supported by qimageformat plugins
Related: bug 434889

M  +6    -1    generators/kimgio/libokularGenerator_kimgio.json
M  +1    -1    generators/kimgio/okularApplication_kimgio.desktop
M  +1    -1    generators/kimgio/okularKimgio.desktop
M  +1    -1    generators/kimgio/org.kde.mobile.okular_kimgio.desktop

https://invent.kde.org/graphics/okular/commit/c38af3e695be5e0cd59732effdc5bb7d63a67951