Commit 02e8f588 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

load and save embedded ICC profiles, based on a patch from Ture Pålsson

2005-10-24  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/png.c: load and save embedded ICC profiles, based
	on a patch from Ture Pålsson (bug #319580).

	* devel-docs/parasites.txt: document the "icc-profile-name" parasite.
parent 4ecf49d7
2005-10-24 Sven Neumann <sven@gimp.org>
* plug-ins/common/png.c: load and save embedded ICC profiles, based
on a patch from Ture Pålsson (bug #319580).
* devel-docs/parasites.txt: document the "icc-profile-name" parasite.
2005-10-24 Jakub Steiner <jimmac@ximian.com>
* themes/Default/images/tools/stock-tool-path-16.png
* themes/Default/images/tools/stock-tool-path-22.png: works on
dark themes (bug #168981)
dark themes (bug #168981)
2005-10-24 Jakub Steiner <jimmac@ximian.com>
* themes/Default/images/tools/stock-tool-airbrush-16.png
* themes/Default/images/tools/stock-tool-airbrush-22.png: make it
work on dark background
work on dark background
2005-10-24 Michael Natterer <mitch@gimp.org>
......
......@@ -164,6 +164,13 @@ Global data follows no strict rules.
manager exists to use this parasite, and it will be used
for interchange between TIFF and PNG (identical profiles)
"icc-profile-name" (IMAGE, PERSISTENT)
The profile name is a convenient name for referring to the
profile. It is for example used in the PNG file format. The
name must be stored in UTF-8 encoding. If a file format uses
a different character encoding, it must be converted to UTF-8
for use as a parasite.
"decompose-data" (IMAGE, NONPERSISTENT)
Starting with GIMP 2.3, this is added to images produced by
the decompose plug-in, and contains information necessary to
......
......@@ -1052,6 +1052,45 @@ load_image (const gchar *filename,
g_free (comment);
}
#if defined(PNG_iCCP_SUPPORTED)
/*
* Get the iCCP (colour profile) chunk, if any, and attach it as
* a parasite
*/
{
png_uint_32 proflen;
png_charp profname, profile;
int profcomp;
if (png_get_iCCP (pp, info, &profname, &profcomp, &profile, &proflen))
{
GimpParasite *parasite;
parasite = gimp_parasite_new ("icc-profile", 0, proflen, profile);
gimp_image_parasite_attach (image, parasite);
gimp_parasite_free (parasite);
if (profname)
{
gchar *tmp = g_convert (profname, strlen (profname),
"ISO-8859-1", "UTF-8", NULL, NULL, NULL);
if (tmp)
{
parasite = gimp_parasite_new ("icc-profile-name", 0,
strlen (tmp), tmp);
gimp_image_parasite_attach (image, parasite);
gimp_parasite_free (parasite);
g_free (tmp);
}
}
}
}
#endif
/*
* Done with the file...
*/
......@@ -1385,6 +1424,32 @@ save_image (const gchar *filename,
#endif /* PNG_LIBPNG_VER > 99 */
#if defined(PNG_iCCP_SUPPORTED)
{
GimpParasite *profile_parasite;
gchar *profile_name = NULL;
profile_parasite = gimp_image_parasite_find (orig_image_ID, "icc-profile");
if (profile_parasite)
{
GimpParasite *parasite = gimp_image_parasite_find (orig_image_ID,
"icc-profile-name");
if (parasite)
profile_name = g_convert (gimp_parasite_data (parasite),
gimp_parasite_data_size (parasite),
"UTF-8", "ISO-8859-1", NULL, NULL, NULL);
png_set_iCCP (pp, info,
profile_name ? profile_name : "ICC profile", 0,
(gchar *) gimp_parasite_data (profile_parasite),
gimp_parasite_data_size (profile_parasite));
g_free (profile_name);
}
}
#endif
png_write_info (pp, info);
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment