Skip to content

Commit

Permalink
add vips7 wrapper for magickload_buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Oct 7, 2015
1 parent a7766b2 commit b8a28f1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
20 changes: 20 additions & 0 deletions libvips/deprecated/im_magick2vips.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
2 changes: 2 additions & 0 deletions libvips/include/vips/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit b8a28f1

Please sign in to comment.