summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk-pixbuf/io-png.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
index 42fb4fe3b..8a2bf3e02 100644
--- a/gdk-pixbuf/io-png.c
+++ b/gdk-pixbuf/io-png.c
@@ -256,6 +256,7 @@ gdk_pixbuf__png_image_load (FILE *f, GError **error)
gint num_texts;
gchar *key;
gchar *value;
+ gdouble gamma;
png_uint_32 x_resolution;
png_uint_32 y_resolution;
int unit_type;
@@ -354,6 +355,17 @@ gdk_pixbuf__png_image_load (FILE *f, GError **error)
g_free (icc_profile_base64);
}
#endif
+
+#if defined(PNG_READ_gAMA_SUPPORTED)
+ /* Extract gamma value */
+ retval = png_get_gAMA (png_ptr, info_ptr, &gamma);
+ if (retval != 0) {
+ char *gamma_str;
+ gamma_str = g_strdup_printf ("%lf", gamma);
+ gdk_pixbuf_set_option (pixbuf, "gamma", gamma_str);
+ g_free (gamma_str);
+ }
+#endif
}
#ifdef PNG_pHYs_SUPPORTED