add vips_vipsload() vips_vipssave() to C API

we didn't have these in the C API before, for some reason
This commit is contained in:
John Cupitt 2015-04-21 14:29:44 +01:00
parent 3cc408fd1e
commit e0a5d28100
3 changed files with 60 additions and 3 deletions

View File

@ -17,6 +17,7 @@
- better conversion to greyscale, thanks bkw
- add vips_image_copy_memory(), improves stability with heavy threading
- jpegsave supports new mozjpeg features [lovell]
- add vips_vipsload(), vips_vipssave() ... why not
26/3/15 started 7.42.4
- im_maxpos_avg() avoids NaN

View File

@ -371,11 +371,12 @@ vips_foreign_init( VipsForeign *object )
*/
static void *
file_add_class( VipsForeignClass *file, GSList **files )
file_add_class( VipsForeignClass *class, GSList **files )
{
/* Append so we don't reverse the list of files.
/* Append so we don't reverse the list of files. Sort will not reorder
* items of equal priority.
*/
*files = g_slist_append( *files, file );
*files = g_slist_append( *files, class );
return( NULL );
}
@ -1681,6 +1682,56 @@ vips_foreign_operation_init( void )
#endif /*HAVE_OPENEXR*/
}
/**
* vips_vipsload:
* @filename: file to load
* @out: decompressed image
* @...: %NULL-terminated list of optional named arguments
*
* Read in a vips image.
*
* See also: vips_vipssave().
*
* Returns: 0 on success, -1 on error.
*/
int
vips_vipsload( const char *filename, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_call_split( "vipsload", ap, filename, out );
va_end( ap );
return( result );
}
/**
* vips_vipssave:
* @in: image to save
* @filename: file to write to
* @...: %NULL-terminated list of optional named arguments
*
* Write @in to @filename in VIPS format.
*
* See also: vips_vipsload().
*
* Returns: 0 on success, -1 on error.
*/
int
vips_vipssave( VipsImage *in, const char *filename, ... )
{
va_list ap;
int result;
va_start( ap, filename );
result = vips_call_split( "vipssave", ap, in, filename );
va_end( ap );
return( result );
}
/**
* vips_magickload:
* @filename: file to load

View File

@ -316,6 +316,11 @@ GType vips_foreign_save_get_type( void );
const char *vips_foreign_find_save( const char *filename );
const char *vips_foreign_find_save_buffer( const char *suffix );
int vips_vipsload( const char *filename, VipsImage **out, ... )
__attribute__((sentinel));
int vips_vipssave( VipsImage *in, const char *filename, ... )
__attribute__((sentinel));
int vips_openslideload( const char *filename, VipsImage **out, ... )
__attribute__((sentinel));