icc import/export cast inputs
This commit is contained in:
parent
e84640af58
commit
0f20f9152b
@ -70,6 +70,7 @@
|
|||||||
- im_blend() also does sizealike, oops
|
- im_blend() also does sizealike, oops
|
||||||
- jpeg write was not inverting CMYK, thanks Ole
|
- jpeg write was not inverting CMYK, thanks Ole
|
||||||
- im_falsecolour() converts to mono 8-bit for you
|
- im_falsecolour() converts to mono 8-bit for you
|
||||||
|
- im_icc_import*/export*() cast inputs for you
|
||||||
|
|
||||||
30/11/10 started 7.24.0
|
30/11/10 started 7.24.0
|
||||||
- bump for new stable
|
- bump for new stable
|
||||||
|
11
TODO
11
TODO
@ -1,18 +1,7 @@
|
|||||||
- maplut should force to 8/16 bit unsigned? or does it?
|
|
||||||
|
|
||||||
- im_vip2tiff() pyr builder should use new temp system
|
- im_vip2tiff() pyr builder should use new temp system
|
||||||
|
|
||||||
- can isanalyze still add spurious messages to the vips error buffer?
|
- can isanalyze still add spurious messages to the vips error buffer?
|
||||||
|
|
||||||
- icc import / export should cast their inputs, they insist on uchar/ushort at
|
|
||||||
the moment
|
|
||||||
|
|
||||||
we could band up (mono->rgb) and banddown (take first three? take forst
|
|
||||||
three, then process, then reattach remainder?) as well
|
|
||||||
|
|
||||||
other colour ops (eg. im_Lab2LCh) just insist on three bands and do a
|
|
||||||
cast to float for you
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- can we call vips7 funcs from the vips8 interface? we already have vips8 from
|
- can we call vips7 funcs from the vips8 interface? we already have vips8 from
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
* written if we are wrinting to a file
|
* written if we are wrinting to a file
|
||||||
* 2/8/10
|
* 2/8/10
|
||||||
* - add lcms2
|
* - add lcms2
|
||||||
|
* 12/7/11
|
||||||
|
* - import and export cast @in to an appropriate format for you
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -487,14 +489,34 @@ import_buf( PEL *in, float *out, int n, Icc *icc )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save a bit of typing.
|
||||||
|
*/
|
||||||
|
#define UC IM_BANDFMT_UCHAR
|
||||||
|
#define US IM_BANDFMT_USHORT
|
||||||
|
|
||||||
|
/* Type mapping: go to uchar or ushort.
|
||||||
|
*/
|
||||||
|
static int bandfmt_icc_import[10] = {
|
||||||
|
/* UC C US S UI I F X D DX */
|
||||||
|
UC, UC, US, US, US, US, US, US, US, US
|
||||||
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
icc_import( IMAGE *in, IMAGE *out, Icc *icc )
|
icc_import( IMAGE *in, IMAGE *out, Icc *icc )
|
||||||
{
|
{
|
||||||
|
IMAGE *t;
|
||||||
DWORD icc_format;
|
DWORD icc_format;
|
||||||
|
|
||||||
if( im_check_uncoded( "im_icc_import", in ) )
|
if( im_check_uncoded( "im_icc_import", in ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
|
/* Cast in to u8/u16.
|
||||||
|
*/
|
||||||
|
if( !(t = im_open_local( out, "im_maplut", "p" )) ||
|
||||||
|
im_clip2fmt( in, t, bandfmt_icc_import[in->BandFmt] ) )
|
||||||
|
return( -1 );
|
||||||
|
in = t;
|
||||||
|
|
||||||
if( !cmsIsIntentSupported( icc->in_profile,
|
if( !cmsIsIntentSupported( icc->in_profile,
|
||||||
icc->intent, LCMS_USED_AS_INPUT ) )
|
icc->intent, LCMS_USED_AS_INPUT ) )
|
||||||
im_warn( "im_icc_import",
|
im_warn( "im_icc_import",
|
||||||
@ -669,6 +691,7 @@ int
|
|||||||
im_icc_export_depth( IMAGE *in, IMAGE *out, int depth,
|
im_icc_export_depth( IMAGE *in, IMAGE *out, int depth,
|
||||||
const char *output_profile_filename, VipsIntent intent )
|
const char *output_profile_filename, VipsIntent intent )
|
||||||
{
|
{
|
||||||
|
IMAGE *t;
|
||||||
Icc *icc;
|
Icc *icc;
|
||||||
DWORD icc_format;
|
DWORD icc_format;
|
||||||
|
|
||||||
@ -694,11 +717,16 @@ im_icc_export_depth( IMAGE *in, IMAGE *out, int depth,
|
|||||||
in = t1;
|
in = t1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Force to float anyway.
|
||||||
|
*/
|
||||||
|
if( !(t = im_open_local( out, "im_icc_export", "p" )) ||
|
||||||
|
im_clip2fmt( in, t, IM_BANDFMT_FLOAT ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
/* Check input image.
|
/* Check input image.
|
||||||
*/
|
*/
|
||||||
if( im_check_uncoded( "im_icc_export", in ) ||
|
if( im_check_uncoded( "im_icc_export", in ) ||
|
||||||
im_check_bands( "im_icc_export", in, 3 ) ||
|
im_check_bands( "im_icc_export", in, 3 ) )
|
||||||
im_check_format( "im_icc_export", in, IM_BANDFMT_FLOAT ) )
|
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( depth != 8 && depth != 16 ) {
|
if( depth != 8 && depth != 16 ) {
|
||||||
|
@ -338,10 +338,10 @@ im_falsecolour( IMAGE *in, IMAGE *out )
|
|||||||
/* Check our args, force to mono 8-bit.
|
/* Check our args, force to mono 8-bit.
|
||||||
*/
|
*/
|
||||||
if( im_piocheck( in, out ) ||
|
if( im_piocheck( in, out ) ||
|
||||||
im_check_uncoded( "im_falsecolour", in ) )
|
im_check_uncoded( "im_falsecolour", in ) ||
|
||||||
im_open_local_array( out, t, 2, "im_falsecolour", "p" ) ||
|
im_open_local_array( out, t, 2, "im_falsecolour", "p" ) ||
|
||||||
im_extract_band( in, t[0], 0 ) ||
|
im_extract_band( in, t[0], 0 ) ||
|
||||||
im_clip2fmt( t[0], t[1], IM_BANDFMT_UCHAR )
|
im_clip2fmt( t[0], t[1], IM_BANDFMT_UCHAR ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
in = t[1];
|
in = t[1];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user