After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 739392 - Replace Jasper plugin with OpenJPEG plugin for JPEG2000
Replace Jasper plugin with OpenJPEG plugin for JPEG2000
Status: RESOLVED NOTABUG
Product: gdk-pixbuf
Classification: Platform
Component: loaders
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2014-10-30 09:48 UTC by Bastien Nocera
Modified: 2016-12-28 17:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bastien Nocera 2014-10-30 09:48:57 UTC
libjasper is abandoned:
https://groups.google.com/forum/#!topic/openjpeg/5qxxVGwV80U
Comment 1 Hussam Al-Tayeb 2016-04-11 18:14:49 UTC
Please do. libjasper requires a lot of security patch maintenance while OpenJPEG is actively under development.
Comment 2 Bastien Nocera 2016-04-12 15:50:33 UTC
What's more likely to happen is the JPEG2000 loader being removed altogether though.
Comment 3 Bastien Nocera 2016-04-12 15:57:06 UTC
Given that JPEG2000 files are usually pretty huge, and that gdk-pixbuf is pretty badly suited to loading those types of files, for me the way to fix this problem would be:
- add a thumbnailer in gegl, or in a third-party repository, that would use gegl to create thumbnails for those sorts of huge files
- add a JPEG2000 loader in gegl based on OpenJPEG instead (it already has one based on libjasper)
- remove the jp2 loader in gdk-pixbuf

Rinse and repeat for TIFF.
Comment 4 Debarshi Ray 2016-04-12 16:19:20 UTC
The GEGL loaders don't have a typical GIO-like GCancellable driven asynchronous API. At the moment, the only way to use them it use it via a GEGL graph that is processed with gegl_node_process [1]. Even if it might appear that GeglProcessor will allow you to process the graph in smaller pieces, it isn't always the case. The loaders will load and decode the file in its entirety in one shot.

Plus, the GEGL loaders don't have little things like applying the embedded orientation.

Therefore, I don't think the GEGL loaders are ready to completely replace the ones in GdkPixbuf. Maybe we should start by adding some API that looks a lot like the gdk_pixbuf_new_from_* functions but gives a GeglBuffer, instead of a GdkPixbuf?

Turning a GeglBuffer to a GdkPixbuf for existing applications should be quite easy. See the gegl:save-pixbuf operation for a possible implementation.

[1] http://www.gegl.org/api.html
Comment 5 Matthias Clasen 2016-04-12 16:43:08 UTC
yes, removing the jp2000 loader gets a +1 from me
Comment 6 Bastien Nocera 2016-04-12 17:12:53 UTC
(In reply to Debarshi Ray from comment #4)
> The GEGL loaders don't have a typical GIO-like GCancellable driven
> asynchronous API. At the moment, the only way to use them it use it via a
> GEGL graph that is processed with gegl_node_process [1]. Even if it might
> appear that GeglProcessor will allow you to process the graph in smaller
> pieces, it isn't always the case. The loaders will load and decode the file
> in its entirety in one shot.
> 
> Plus, the GEGL loaders don't have little things like applying the embedded
> orientation.

We can always add that to GEGL eventually.

> Therefore, I don't think the GEGL loaders are ready to completely replace
> the ones in GdkPixbuf.

I didn't talk about replacing gdk-pixbuf with Gegl for SVG, or PNG, or any of those other types of images. I'm specifically talking of JPEG2000 and TIFF, both of which have problems handling huge files.

> Maybe we should start by adding some API that looks a
> lot like the gdk_pixbuf_new_from_* functions but gives a GeglBuffer, instead
> of a GdkPixbuf?

No, because we'd get the same problem back. We *do not* want a GdkPixbuf, because for a 20k x 20k b&w image, we'd be using more than a gig of RAM with GdkPixbuf, whereas gegl would keep it in the same colourspace, reducing its in-RAM size greatly.

See bug 666391.
Comment 7 Debarshi Ray 2016-04-12 17:45:18 UTC
(In reply to Bastien Nocera from comment #6)
> (In reply to Debarshi Ray from comment #4)
> > The GEGL loaders don't have a typical GIO-like GCancellable driven
> > asynchronous API. At the moment, the only way to use them it use it via a
> > GEGL graph that is processed with gegl_node_process [1]. Even if it might
> > appear that GeglProcessor will allow you to process the graph in smaller
> > pieces, it isn't always the case. The loaders will load and decode the file
> > in its entirety in one shot.
> > 
> > Plus, the GEGL loaders don't have little things like applying the embedded
> > orientation.

Also, the bit about GdkPixbuf being able to use a scale factor to directly downscale when loading. It can be a significant win in certain cases, and is missing in GEGL.

Then colour management. It is pretty straightforward with GdkPixbuf as compared to GEGL.

None of these are unsolvable problems, but taken together they do present a significant obstacle for an application.

> We can always add that to GEGL eventually.

Eventually ... :)

As someone who is writing a non-trivial application based on GEGL, I have been trying to convince people about the need for such an API. If we think that we are going encourage more people to use GEGL, then maybe we should take this up more seriously.

Note that even GIMP master/2.9.x doesn't use GEGL's loaders. It continues to use its own which have certain niceties (like applying embedded orientation) that are missing from the ones in GEGL.

> > Therefore, I don't think the GEGL loaders are ready to completely replace
> > the ones in GdkPixbuf.
> 
> I didn't talk about replacing gdk-pixbuf with Gegl for SVG, or PNG, or any
> of those other types of images. I'm specifically talking of JPEG2000 and
> TIFF, both of which have problems handling huge files.

It is problematic for applications like Eye of GNOME which rely on GdkPixbuf for the loading. (Doesn't shotwell do the same?) Those applications will now need something else to load those kinds of images.

If that "something else" is going to be GEGL then they would run into all the above problems.

> > Maybe we should start by adding some API that looks a
> > lot like the gdk_pixbuf_new_from_* functions but gives a GeglBuffer, instead
> > of a GdkPixbuf?
> 
> No, because we'd get the same problem back. We *do not* want a GdkPixbuf,

Did I say GdkPixbuf? I said *GeglBuffer*. :)

> because for a 20k x 20k b&w image, we'd be using more than a gig of RAM with
> GdkPixbuf, whereas gegl would keep it in the same colourspace, reducing its
> in-RAM size greatly.

(While GEGL (through Babl) knows a lot more about colour spaces than GdkPixbuf, its ability to handle larger than RAM images is more due to the tiling in GeglBuffers than colour space optimizations.)
Comment 8 Hussam Al-Tayeb 2016-11-11 13:10:50 UTC
JasPer looks actively maintained again https://github.com/mdadams/jasper
Comment 9 Bastien Nocera 2016-12-28 17:23:18 UTC
Let's consider this fixed, whatever the status of loading huge images with GdkPixbuf.