better CLI imagevec handling

This commit is contained in:
John Cupitt 2011-11-22 09:26:31 +00:00
parent 951dc0f83e
commit c0150ea3c3
5 changed files with 30 additions and 32 deletions

28
TODO
View File

@ -1,37 +1,21 @@
- imagevec in can be non-NULL if the images do not exist
not enough to check that imagevec is non-NULL, have to check all images too,
argh
test with
$ vips bandjoin a b
where 'a' does not exist
- move recomb to bandary?
- can we common-up bits of recomb and bandmean? any other ops? bandjoin must
be rather similar?
- transform_g_string_array_image() can't handle quoted strings, so filenames
with spaces will break
they should certainly be able to share a y pixel loop
is there an easy fix? can we reuse code from the csv parser?
yes, extract_band is very similar too
make a class of Bandary ops ... n images in, one image out, number of bands
changes (ie. don't bandalike, but do sizealike/formatalike), then a buffer
processing function
base on bandjoin since that's the most general
- test docs
gtk-doc can't introspect to generate class docs since it has no way to init
the classes ... investigate
- add vips_extract_real(), vips_extract_imag(), vips_complexjoin()
- try an area operation, like conv, VipsArea? oops no haha what name should we

View File

@ -123,11 +123,14 @@ vips_bandary_build( VipsObject *object )
if( VIPS_OBJECT_CLASS( vips_bandary_parent_class )->build( object ) )
return( -1 );
if( bandary->n <= 0 ) {
vips_error( "VipsBandary", "%s", _( "no input images" ) );
return( -1 );
}
if( bandary->n > MAX_INPUT_IMAGES ) {
vips_error( "VipsBandary", "%s", _( "too many input images" ) );
return( -1 );
}
if( vips_image_pio_output( conversion->out ) )
return( -1 );
for( i = 0; i < bandary->n; i++ )

View File

@ -522,15 +522,14 @@ vips_format_for_file( const char *filename )
im_filename_split( filename, name, options );
if( !im_existsf( "%s", name ) ) {
im_error( "format_for_file",
_( "file \"%s\" not found" ), name );
im_error( "VipsFormat", _( "file \"%s\" not found" ), name );
return( NULL );
}
if( !(format = (VipsFormatClass *) vips_format_map(
(VSListMap2Fn) format_for_file_sub,
(void *) filename, (void *) name )) ) {
im_error( "format_for_file",
im_error( "VipsFormat",
_( "file \"%s\" not a known format" ), name );
return( NULL );
}
@ -569,7 +568,7 @@ vips_format_for_name( const char *filename )
if( !(format = (VipsFormatClass *) vips_format_map(
(VSListMap2Fn) format_for_name_sub,
(void *) filename, NULL )) ) {
im_error( "vips_format_for_name",
im_error( "VipsFormat",
_( "\"%s\" is not a supported image format." ),
filename );

View File

@ -906,8 +906,16 @@ vips_call_argv( VipsOperation *operation, int argc, char **argv )
call.argv = argv;
call.i = 0;
(void) vips_argument_map( VIPS_OBJECT( operation ),
vips_call_argv_input, &call, NULL );
if( vips_argument_map( VIPS_OBJECT( operation ),
vips_call_argv_input, &call, NULL ) ) {
/* We must unref any output objects, they are holding refs to
* the operation.
*/
(void) vips_argument_map( VIPS_OBJECT( operation ),
vips_call_argv_unref_output, NULL, NULL );
return( -1 );
}
/* Any unused arguments? We must fail. Consider eg. "vips bandjoin a b
* c". This would overwrite b with a and ignore c, potentially

View File

@ -803,9 +803,13 @@ transform_g_string_array_image( const GValue *src_value, GValue *dest_value )
str = g_value_dup_string( src_value );
for( i = 0, p = str; (q = vips_break_token( p, " " )); i++, p = q )
/* Sadly there's no error return possible here.
*/
array[i] = G_OBJECT( vips_image_new_from_file( p ) );
if( !(array[i] = G_OBJECT( vips_image_new_from_file( p ) )) ) {
/* Set the dest to length zero to indicate error.
*/
vips_value_set_array_object( dest_value, 0 );
g_free( str );
return;
}
g_free( str );
}