GNOME Bugzilla – Bug 579003
Need pixbuf orientation available on GdkPixbufLoader "size-prepared" signal
Last modified: 2018-05-22 13:10:03 UTC
It would be useful to make pixbuf orientation available by the time GdkPixbufLoader "size-prepared" signal is emitted, so that the scaled size for the pixbuf can be determined correctly given the available width and height. It is currently not available from the pixbuf returned by gdk_pixbuf_loader_get_pixbuf() at that time of the signal or from any function of the GdkPixbufLoader itself. The workaround I am using now is loading a scaled image with the default orientation, then calling gdk_pixbuf_apply_embedded_orientation() for it, checking if the width of the pixbuf returned by that function is different from the width of the original pixbuf, and if it is, reloading the scaled image with the available dimensions reversed, and calling gdk_pixbuf_apply_embedded_orientation() on it. There are a few possibilities, including making related functions available for the pixbuf returned by the GdkPixbufLoader at the time or having the GdkPixbufLoader itself have a function to get or apply embedded orientation before the pixbuf is actually loaded. Since getting embedded orientation can return multiple values the same way "orientation" option for gdk_pixbuf_get_option() returns multiple values, it might be useful to just have a function that returns a boolean indicating if rotation will be necessary when embedded orientation is applied.
Yes, the current orientation tag handling is sub-optimal for progressive loaders. I would suggest that the pixbuf loaders (jpg and tif) should ALWAYS respect the orientation tags, and that gdk_pixbuf_apply_embedded_orientation should die (that is, be deprecated and modified to simply to return the original pixbuf). I have never heard a compelling reason to ignore the orientation tag. I'm not in a position to offer any code, however... - Mike
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/21.