Bug 26330 - Gimp is unable to open HEIC files
Summary: Gimp is unable to open HEIC files
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 7
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL: https://en.wikipedia.org/wiki/High_Ef...
Whiteboard: MGA7-64-OK
Keywords: advisory, validated_update
Depends on:
Blocks:
 
Reported: 2020-03-11 19:10 CET by Frédéric "LpSolit" Buclin
Modified: 2020-04-01 03:58 CEST (History)
7 users (show)

See Also:
Source RPM: gimp-2.10.10-1.1.mga7
CVE:
Status comment:


Attachments

Description Frédéric "LpSolit" Buclin 2020-03-11 19:10:11 CET
I have several pictures using the .heic file format, and Gimp in Mageia 7 is unable to open them. This is working fine on Windows 10. I don't know if updating Gimp to the current 2.10.18 version would help.
Comment 1 Dave Hodgins 2020-03-11 19:46:09 CET
According to https://github.com/strukturag/heif-gimp-plugin it was added
to gimp in 2.10.2, but it looks like installing that one plugin manually
may be all that's needed, rather then all of the new version of gimp.

The version of imagemagick in Mageia 7 appears to support heif formats,
so it might be able to be used to convert to another format prior to editing
with gimp.

CC: (none) => davidwhodgins

Comment 2 Lewis Smith 2020-03-11 20:43:13 CET
(In reply to Frédéric "LpSolit" Buclin from comment #0)
> I don't know if
> updating Gimp to the current 2.10.18 version would help.
I doubt it.
https://github.com/strukturag/heif-gimp-plugin
> This is a GIMP plugin for loading and saving HEIF images (High Efficiency
> Image File Format).
> this plugin is part of GIMP v2.10.2 You only need to manually install
> this plugin if you are running a lower version of GIMP.
> This code depends on libheif and libde265
lib64x265_169-3.0-2.mga7.tainted
libheif-1.4.1-1.mga7.tainted
lib64heif1-1.4.1-1.mga7.tainted

https://www.gimpusers.com/forums/gimp-user/21240-heic-or-heif-files-not-opened
has useful comments.
The given Wikipedia link starts "the article treats HEIF and HEIC as synonymous, even though they're not".

We seem to have the necessary libraries, but I cannot see any reference to this HEIF Gimp plugin. It does not show in our list of gimp-plugin-* (either SRPMs or packages). Certainly HEIC/HEIF do not feature in the Open dialogue "Select file type" list. Looks like it got overlooked.

Assigning globally for Gimp per se; CC'ing Matteo & Chris as other Gimp plugin maintainers

CC: (none) => eatdirt, matteo.pasotti
Assignee: bugsquad => pkg-bugs

Comment 3 Chris Denice 2020-03-15 17:25:50 CET
I suspect we simply did not add the required lib and gimp was not built using this feature. I'll have a look, the fix should be trivial.

I'll be happy to have a link to an example file to test though!
Thanks.
Comment 4 Chris Denice 2020-03-15 21:54:49 CET
Here a test file to test the version of gimp landing in updates_testing:

https://github.com/tigranbs/test-heic-images


I've just hit the bug. The problem is that libheif is not free software, it exists only in tainted, so we would need to build a special tainted version of gimp for that. :-(
Comment 5 Chris Denice 2020-03-15 22:54:51 CET
Ok, gimp build with libheif is landing soon in tainted/updates_testing


Suggested advisory:
========================

Gimp package version 2.10.10-1.3.mga7 added to tainted repository to allow for the opening of the heif image format.


References:
========================
https://bugs.mageia.org/show_bug.cgi?id=26330

Updated packages in tainted/updates_testing:
========================
gimp-2.10.10-1.3.mga7.tainted
gimp-python-2.10.10-1.3.mga7.tainted
lib(64)gimp2.0_0-2.10.10-1.3.mga7.tainted
lib(64)gimp2.0-devel-2.10.10-1.3.mga7.tainted

Source RPMs: 
gimp-2.10.10-1.3.mga7.tainted.src.rpm

Assignee: pkg-bugs => qa-bugs

Comment 6 Morgan Leijström 2020-03-15 23:06:29 CET
(In reply to Chris Denice from comment #4)
> The problem is that libheif is not free software

I am no lawyer, buy i think it is OK to have it in normal updates:

libheif is LGPL, see bottom of https://github.com/strukturag/libheif

https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License

CC: (none) => fri

Comment 7 Chris Denice 2020-03-15 23:10:30 CET
We have libheif in tainted, so we have no other choices for mga7. I think this maybe because heif is a container, and it can contain patented thing, aka x265.
Comment 8 Morgan Leijström 2020-03-15 23:33:19 CET
I think the question should be lifted at least for mga8. (how to do that?)

The container itself is free, and this lib is only the container...?
I guess at least theoretically many proptrietary formats can exist for many container formats.  Government dont forbid lorries just because they might carry boxes loaded with with illegal wares.
Comment 9 Chris Denice 2020-03-15 23:36:30 CET
Yep, we could ask on the mailing list, kekepower imported the lib. If we can have it in core for mga8, that would simplify quite some things indeed!
Comment 10 Morgan Leijström 2020-03-16 00:04:54 CET
Great, i see you asked now on dev list :)
Comment 11 Len Lawrence 2020-03-16 00:16:33 CET
mga7, x86_64

Version gimp-2.10.10-1.1.mga7 installed.
Confirmed that current version of Gimp cannot open .heic files; had two examples already - downloaded the GitHub examples as well.  Gimp always reports "Unknown file type".

Waiting for the mirror to sync.

CC: (none) => tarazed25

Comment 12 Chris Denice 2020-03-16 11:26:06 CET
Don't get excited to much, we have opened a pandora box revelling various other problems :)
Comment 13 Chris Denice 2020-03-16 13:42:32 CET
Let me try again!

I have updated libheif which now appears in both core and tainted repository. In the core repository, it only supports opening jpg, png etc files, but not files encoded with x265. The one in tainted repos, allows opening file encoded in x265. I have also pushed into *core* a new version of gimp compiled against libheif. Therefore, it should be able to open heif files now.

The correct behaviour of gimp should be:
1) You don't have the tainted repos activated. Installing gimp should trigger the install of the free libheif. If you try to open a heic file encoded in x265, you will get an error

2) You have tainted repos activated. Installing gimp should trigger the install of the tainted libheif. Opening a heic file encoded in x265 will work.

Suggested advisory:
========================
Gimp package updated to version 2.10.10-1.6.mga7 and build against libheif to allow for the opening of the heif image format. Support for heif files encoded in x265 is provided by using the tainted repository.


Updated packages in tainted/updates_testing:
========================
lib(64)heif1-1.4.1-1.1.mga7.tainted
lib(64)heif-devel-1.4.1-1.1.mga7.tainted

Updated packages in core/updates_testing:
========================
lib(64)heif1-1.4.1-1.1.mga7
lib(64)heif-devel-1.4.1-1.1.mga7
gimp-2.10.10-1.6.mga7
gimp-python-2.10.10-1.6.mga7
lib(64)gimp2.0_0-2.10.10-1.6.mga7
lib(64)gimp2.0-devel-2.10.10-1.6.mga7

Source RPMs:
gimp-2.10.10-1.6.mga7.src.rpm
libheif-1.4.1-1.1.mga7.src.rpm
Comment 14 Chris Denice 2020-03-16 13:44:19 CET
I'll push the same fixes to Cauldron!
Comment 15 Len Lawrence 2020-03-16 17:13:49 CET
mga7, x86_64

OK, restart.  Enabled core updates testing and updated the gimp packages.
The Gimp failed to open .heic images with the message "unsupported feature: unsupported codec".  Sofar, so good.

Enabled tainted/updates_testing

$ urpmi.update -a
$ sudo urpmi --searchmedia "tainted" lib64heif1
  lib64heif-devel                1.4.1        1.1.mga7.tai> x86_64  
  lib64heif1                     1.4.1        1.1.mga7.tai> x86_64  
  libheif                        1.4.1        1.1.mga7.tai> x86_64  

$ gimp image1.heic
A fair number of errors here but the image displayed perfectly.  Opened three more images successively from the file menu in each image window without provoking any more errors.  Those errors appear also when launching gimp without arguments; they may be worth quoting:
$ gimp
GIMP-Error: Calling error for procedure 'gimp-procedural-db-proc-info':
Procedure 'gimp--gimp-append-data' not found

gimp-make-img-map: Unknown option -gimp! (ERROR)
/usr/lib64/gimp/2.0/plug-ins/gimp-make-img-map is a GIMP plug-in and must be run by GIMP to be used
gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error
GIMP-Error: Calling error for procedure 'gimp-procedural-db-proc-info':
Procedure 'gimp--gimp-append-data' not found

Gtk-CRITICAL **: IA__gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed at /usr/share/perl5/XSLoader.pm line 111.
Gtk-CRITICAL **: IA__gtk_icon_theme_prepend_search_path: assertion 'GTK_IS_ICON_THEME (icon_theme)' failed at /usr/share/perl5/XSLoader.pm line 111.
Gtk-CRITICAL **: IA__gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed at /usr/share/perl5/XSLoader.pm line 111.
GLib-GObject-CRITICAL **: g_object_get: assertion 'G_IS_OBJECT (object)' failed at /usr/share/perl5/XSLoader.pm line 111.
GLib-GObject-CRITICAL **: g_object_set: assertion 'G_IS_OBJECT (object)' failed at /usr/share/perl5/XSLoader.pm line 111.
free(): invalid pointer
gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error

This would not be obvious if gimp were launched from the system menus.
However, it all works as expected with respect to the heif format.

Whiteboard: (none) => MGA7-64-OK

Comment 16 Chris Denice 2020-03-16 18:57:04 CET
thanks Len for the exhaustive testing. These error messages may be coming from some of the gimp plugins installed (perl-Gimp I suspect). If you remove that package, logs should be empty. Cannot tell if this is an issue, but at least, it is not in the gimp package.
Comment 17 Len Lawrence 2020-03-16 20:54:30 CET
@Chris Denice re comment 16.
Removed perl-Gimp on the off-chance and gimp is now completely comfortable to use.  No more error reports.  Well spotted!
Comment 18 Morgan Leijström 2020-03-17 12:27:49 CET
Nice solution, well done!

But cant we use GPL2?  From http://x265.org/ :
"x265 is available under the terms of the open source GNU GPL 2 license."


Well, i think it is better to open that Pandora's box for any similar problems now, than closer to mga8 release ;)
Comment 19 Morgan Leijström 2020-03-17 17:36:57 CET
Marting W on dev list helped finding regarding x265:

 We may have the source code but using a compiled program may be illegal.

> See the second paragraph of the "Legal Notices" section in
> https://x265.readthedocs.io/en/default/introduction.html
>
> We don't have a license for the HEVC patents.
Comment 20 Thomas Andrews 2020-03-18 16:38:23 CET
Sounds like a debate for another place, Morgan. I'm going to validate this one as a solution that works now. 

Advisory in Comment 13.

Keywords: (none) => validated_update
CC: (none) => andrewsfarm, sysadmin-bugs

Comment 21 Morgan Leijström 2020-03-18 17:30:44 CET
There is no debate, i just had to understand, and updated with the result :)

I agree fully with the solution here.

( Now if this solution should be applied for other packages, i pass... )
Comment 22 Frédéric "LpSolit" Buclin 2020-03-31 12:35:57 CEST
What still needs to be done to be pushed as an update?
Comment 23 Thomas Andrews 2020-03-31 17:16:03 CEST
I have been wondering the same thing. This one needs to have the advisory uploaded to SVN, for one. But we have other updates that are waiting. Some of them need advisories, too, but a few do not.

We should give some consideration, however, to the possibility that our already thinly-spread staff could be even more thinly-spread because of COVID-19.
Dave Hodgins 2020-03-31 23:59:57 CEST

Keywords: (none) => advisory

Comment 24 Mageia Robot 2020-04-01 03:58:15 CEST
An update for this issue has been pushed to the Mageia Updates repository.

https://advisories.mageia.org/MGAA-2020-0086.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.