add vips7 wrapper for magickload_buffer

see https://github.com/jcupitt/ruby-vips/issues/69
This commit is contained in:
John Cupitt 2015-10-07 14:48:32 +01:00
parent a7766b28b3
commit b8a28f1a8d
3 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,6 @@
7/10/15 started 8.2.0
- added im_bufmagick2vips(), a vips7 wrapper for magick load from buffer
7/5/15 starteld 8.1.0
- add vips_premultiply(), vips_unpremultiply()
- change the alpha range rules for vips_flatten() to match vips_premultiply()

View File

@ -97,3 +97,23 @@ vips_format_magick_init( VipsFormatMagick *object )
}
G_DEFINE_TYPE( VipsFormatMagick, vips_format_magick, VIPS_TYPE_FORMAT );
int
im_bufmagick2vips( void *buf, size_t len, IMAGE *out, gboolean header_only )
{
VipsImage *t;
/* header_only is automatic ... this call will only decompress on
* pixel access.
*/
if( vips_magickload_buffer( buf, len, &t, NULL ) )
return( -1 );
if( vips_image_write( t, out ) ) {
g_object_unref( t );
return( -1 );
}
g_object_unref( t );
return( 0 );
}

View File

@ -137,6 +137,8 @@ int im_tile_cache( VipsImage *in, VipsImage *out,
int tile_width, int tile_height, int max_tiles );
int im_magick2vips( const char *filename, VipsImage *out );
int im_bufmagick2vips( void *buf, size_t len,
VipsImage *out, gboolean header_only );
int im_exr2vips( const char *filename, VipsImage *out );