/* Init function for input images. */ static int input_image_init( im_object *obj, char *str ) { IMAGE **im = (IMAGE **) obj; return( !(*im = vips__deprecated_open_read( str, FALSE )) ); }
VipsImage * im_open( const char *filename, const char *mode ) { VipsImage *image; /* Pass in a nonsense name for argv0 ... this init path is only here * for old programs which are missing an vips_init() call. We need * i18n set up before we can translate. */ if( vips_init( "giant_banana" ) ) vips_error_clear(); /* We have to go via the old VipsFormat system so we can support the * "filename:option" syntax. */ if( strcmp( mode, "r" ) == 0 || strcmp( mode, "rd" ) == 0 ) { if( !(image = vips__deprecated_open_read( filename )) ) return( NULL ); } else if( strcmp( mode, "w" ) == 0 ) { if( !(image = vips__deprecated_open_write( filename )) ) return( NULL ); } else { if( !(image = vips_image_new_mode( filename, mode )) ) return( NULL ); } return( image ); }