Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GNOME
gThumb
Commits
0eaed698
Commit
0eaed698
authored
Jun 27, 2017
by
Paolo Bacchilega
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jpeg reader: use the sRGB profile if the ColorSpace tag is set to sRGB
parent
d06b6d8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
5 deletions
+42
-5
extensions/cairo_io/cairo-image-surface-jpeg.c
extensions/cairo_io/cairo-image-surface-jpeg.c
+16
-5
gthumb/gth-icc-profile.c
gthumb/gth-icc-profile.c
+25
-0
gthumb/gth-icc-profile.h
gthumb/gth-icc-profile.h
+1
-0
No files found.
extensions/cairo_io/cairo-image-surface-jpeg.c
View file @
0eaed698
...
@@ -200,7 +200,7 @@ _cairo_image_surface_create_from_jpeg (GInputStream *istream,
...
@@ -200,7 +200,7 @@ _cairo_image_surface_create_from_jpeg (GInputStream *istream,
_jpeg_info_data_init
(
&
jpeg_info
);
_jpeg_info_data_init
(
&
jpeg_info
);
info_flags
=
_JPEG_INFO_EXIF_ORIENTATION
;
info_flags
=
_JPEG_INFO_EXIF_ORIENTATION
;
#if HAVE_LCMS2
#if HAVE_LCMS2
info_flags
|=
_JPEG_INFO_ICC_PROFILE
;
info_flags
|=
_JPEG_INFO_EXIF_COLOR_SPACE
|
_JPEG_INFO_ICC_PROFILE
;
#endif
#endif
_jpeg_info_get_from_buffer
(
in_buffer
,
in_buffer_size
,
info_flags
,
&
jpeg_info
);
_jpeg_info_get_from_buffer
(
in_buffer
,
in_buffer_size
,
info_flags
,
&
jpeg_info
);
if
(
jpeg_info
.
valid
&
_JPEG_INFO_EXIF_ORIENTATION
)
if
(
jpeg_info
.
valid
&
_JPEG_INFO_EXIF_ORIENTATION
)
...
@@ -208,10 +208,21 @@ _cairo_image_surface_create_from_jpeg (GInputStream *istream,
...
@@ -208,10 +208,21 @@ _cairo_image_surface_create_from_jpeg (GInputStream *istream,
else
else
orientation
=
GTH_TRANSFORM_NONE
;
orientation
=
GTH_TRANSFORM_NONE
;
#if HAVE_LCMS2
#if HAVE_LCMS2
if
(
jpeg_info
.
valid
&
_JPEG_INFO_ICC_PROFILE
)
{
{
GthICCProfile
*
profile
=
gth_icc_profile_new
(
GTH_ICC_PROFILE_ID_UNKNOWN
,
cmsOpenProfileFromMem
(
jpeg_info
.
icc_data
,
jpeg_info
.
icc_data_size
));
GthICCProfile
*
profile
=
NULL
;
gth_image_set_icc_profile
(
image
,
profile
);
g_object_unref
(
profile
);
if
(
jpeg_info
.
valid
&
_JPEG_INFO_ICC_PROFILE
)
{
profile
=
gth_icc_profile_new
(
GTH_ICC_PROFILE_ID_UNKNOWN
,
cmsOpenProfileFromMem
(
jpeg_info
.
icc_data
,
jpeg_info
.
icc_data_size
));
}
else
if
(
jpeg_info
.
valid
&
_JPEG_INFO_EXIF_COLOR_SPACE
)
{
if
(
jpeg_info
.
color_space
==
GTH_COLOR_SPACE_SRGB
)
profile
=
gth_icc_profile_new_srgb
();
}
if
(
profile
!=
NULL
)
{
gth_image_set_icc_profile
(
image
,
profile
);
g_object_unref
(
profile
);
}
}
}
#endif
#endif
_jpeg_info_data_dispose
(
&
jpeg_info
);
_jpeg_info_data_dispose
(
&
jpeg_info
);
...
...
gthumb/gth-icc-profile.c
View file @
0eaed698
...
@@ -169,6 +169,31 @@ gth_icc_profile_new (const char *id,
...
@@ -169,6 +169,31 @@ gth_icc_profile_new (const char *id,
}
}
GthICCProfile
*
gth_icc_profile_new_srgb
(
void
)
{
#ifdef HAVE_LCMS2
char
*
id
;
GthCMSProfile
cmd_profile
;
GthICCProfile
*
icc_profile
;
id
=
g_strdup
(
"standard://srgb"
);
cmd_profile
=
(
GthCMSProfile
)
cmsCreate_sRGBProfile
();
icc_profile
=
gth_icc_profile_new
(
id
,
cmd_profile
);
g_free
(
id
);
return
icc_profile
;
#else
return
NULL
;
#endif
}
const
char
*
const
char
*
gth_icc_profile_get_id
(
GthICCProfile
*
self
)
gth_icc_profile_get_id
(
GthICCProfile
*
self
)
{
{
...
...
gthumb/gth-icc-profile.h
View file @
0eaed698
...
@@ -79,6 +79,7 @@ void gth_cms_transform_free (GthCMSTransform transform);
...
@@ -79,6 +79,7 @@ void gth_cms_transform_free (GthCMSTransform transform);
GType
gth_icc_profile_get_type
(
void
);
GType
gth_icc_profile_get_type
(
void
);
GthICCProfile
*
gth_icc_profile_new
(
const
char
*
id
,
GthICCProfile
*
gth_icc_profile_new
(
const
char
*
id
,
GthCMSProfile
profile
);
GthCMSProfile
profile
);
GthICCProfile
*
gth_icc_profile_new_srgb
(
void
);
const
char
*
gth_icc_profile_get_id
(
GthICCProfile
*
icc_profile
);
const
char
*
gth_icc_profile_get_id
(
GthICCProfile
*
icc_profile
);
gboolean
gth_icc_profile_id_is_unknown
(
const
char
*
id
);
gboolean
gth_icc_profile_id_is_unknown
(
const
char
*
id
);
GthCMSProfile
gth_icc_profile_get_profile
(
GthICCProfile
*
icc_profile
);
GthCMSProfile
gth_icc_profile_get_profile
(
GthICCProfile
*
icc_profile
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment