better colour management for vipsthumbnail
This commit is contained in:
parent
b8525c6d47
commit
17ef02861e
10
TODO
10
TODO
@ -1,13 +1,3 @@
|
|||||||
- vipsthumbnail.c should import untagged images with an sRGB profile
|
|
||||||
|
|
||||||
argh ... lcms has
|
|
||||||
|
|
||||||
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreate_sRGBProfile(void);
|
|
||||||
|
|
||||||
perhaps we should expose this in VIPS somehow?
|
|
||||||
|
|
||||||
better: get the user to supply a default input profile
|
|
||||||
|
|
||||||
- we sill have the old flood-fill code there, move to deprecated
|
- we sill have the old flood-fill code there, move to deprecated
|
||||||
|
|
||||||
should we have new API? we could have a single "im_floodfill" that allows
|
should we have new API? we could have a single "im_floodfill" that allows
|
||||||
|
@ -23,7 +23,8 @@ static gboolean verbose = FALSE;
|
|||||||
static int use_disc_threshold = 1024 * 1024;
|
static int use_disc_threshold = 1024 * 1024;
|
||||||
static int thumbnail_size = 128;
|
static int thumbnail_size = 128;
|
||||||
static char *thumbnail_format = "tn_%s.jpg";
|
static char *thumbnail_format = "tn_%s.jpg";
|
||||||
static char *colour_profile = NULL;
|
static char *export_profile = NULL;
|
||||||
|
static char *import_profile = NULL;
|
||||||
|
|
||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = {
|
||||||
{ "size", 's', 0, G_OPTION_ARG_INT, &thumbnail_size,
|
{ "size", 's', 0, G_OPTION_ARG_INT, &thumbnail_size,
|
||||||
@ -32,8 +33,10 @@ static GOptionEntry options[] = {
|
|||||||
N_( "set thumbnail format to S" ), "S" },
|
N_( "set thumbnail format to S" ), "S" },
|
||||||
{ "disc", 'd', 0, G_OPTION_ARG_INT, &use_disc_threshold,
|
{ "disc", 'd', 0, G_OPTION_ARG_INT, &use_disc_threshold,
|
||||||
N_( "set disc use threshold to N" ), "N" },
|
N_( "set disc use threshold to N" ), "N" },
|
||||||
{ "profile", 'p', 0, G_OPTION_ARG_STRING, &colour_profile,
|
{ "eprofile", 'e', 0, G_OPTION_ARG_STRING, &export_profile,
|
||||||
N_( "export with profile P" ), "P" },
|
N_( "export with profile P" ), "P" },
|
||||||
|
{ "iprofile", 'i', 0, G_OPTION_ARG_STRING, &import_profile,
|
||||||
|
N_( "import untagged images with profile P" ), "P" },
|
||||||
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
|
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
|
||||||
N_( "verbose output" ), NULL },
|
N_( "verbose output" ), NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
@ -212,17 +215,40 @@ shrink_factor( IMAGE *in, IMAGE *out )
|
|||||||
x = t[4];
|
x = t[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Optionally transform to the target device space, provided the image
|
/* Colour management: we can transform the image if we have an output
|
||||||
* has a profile.
|
* profile and an input profile. The input profile can be in the
|
||||||
|
* image, or if there is no profile there, supplied by the user.
|
||||||
*/
|
*/
|
||||||
if( colour_profile && im_header_get_typeof( x, IM_META_ICC_NAME ) ) {
|
if( export_profile &&
|
||||||
if( im_icc_import_embedded( x, t[5],
|
(im_header_get_typeof( x, IM_META_ICC_NAME ) ||
|
||||||
IM_INTENT_RELATIVE_COLORIMETRIC ) ||
|
import_profile) ) {
|
||||||
im_icc_export_depth( t[5], t[6],
|
if( im_header_get_typeof( x, IM_META_ICC_NAME ) ) {
|
||||||
8, colour_profile,
|
if( im_icc_import_embedded( x, t[5],
|
||||||
IM_INTENT_RELATIVE_COLORIMETRIC ) )
|
IM_INTENT_RELATIVE_COLORIMETRIC ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
|
if( verbose )
|
||||||
|
printf( "importing with embedded profile\n" );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( im_icc_import( x, t[5],
|
||||||
|
import_profile,
|
||||||
|
IM_INTENT_RELATIVE_COLORIMETRIC ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
|
if( verbose )
|
||||||
|
printf( "importing with profile %s\n",
|
||||||
|
import_profile );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( im_icc_export_depth( t[5], t[6],
|
||||||
|
8, export_profile,
|
||||||
|
IM_INTENT_RELATIVE_COLORIMETRIC ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
|
if( verbose )
|
||||||
|
printf( "exporting with profile %s\n", export_profile );
|
||||||
|
|
||||||
x = t[6];
|
x = t[6];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user