[gtk/wip/otte/color-profiles: 104/111] jpeg: Save color profile information
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/color-profiles: 104/111] jpeg: Save color profile information
- Date: Sat, 2 Oct 2021 02:53:26 +0000 (UTC)
commit ec559232e8a6716847a18aad34c9a6f002cb6013
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Sep 29 14:26:18 2021 -0400
jpeg: Save color profile information
When writing a jpeg image, include the icc profile.
gdk/loaders/gdkjpeg.c | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/gdk/loaders/gdkjpeg.c b/gdk/loaders/gdkjpeg.c
index 82ab1c0cd6..4dfc86a927 100644
--- a/gdk/loaders/gdkjpeg.c
+++ b/gdk/loaders/gdkjpeg.c
@@ -301,9 +301,12 @@ gdk_save_jpeg (GdkTexture *texture)
guchar *input = NULL;
guchar *row;
int width, height, stride;
+ GdkColorProfile *color_profile;
+ GBytes *bytes;
width = gdk_texture_get_width (texture);
height = gdk_texture_get_height (texture);
+ color_profile = gdk_texture_get_color_profile (texture);
info.err = jpeg_std_error (&jerr.pub);
jerr.pub.error_exit = fatal_error_handler;
@@ -337,6 +340,12 @@ gdk_save_jpeg (GdkTexture *texture)
jpeg_start_compress (&info, TRUE);
+ bytes = gdk_color_profile_get_icc_profile (color_profile);
+ jpeg_write_icc_profile (&info,
+ g_bytes_get_data (bytes, NULL),
+ g_bytes_get_size (bytes));
+ g_bytes_unref (bytes);
+
while (info.next_scanline < info.image_height)
{
row = &input[info.next_scanline * stride];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]