diff --git a/ChangeLog b/ChangeLog index ad156c13..1c6ae058 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,7 @@ - tiff reader can do 1, 2, 4, 8 bit palette images - tiff palette read can do mono images - im_bufjpeg2vips() has a "header_only" parameter +- added vips_image_get_data() 30/11/10 started 7.24.0 - bump for new stable diff --git a/libvips/format/im_jpeg2vips.c b/libvips/format/im_jpeg2vips.c index 3033f0e4..449fd19e 100644 --- a/libvips/format/im_jpeg2vips.c +++ b/libvips/format/im_jpeg2vips.c @@ -1053,12 +1053,6 @@ im_bufjpeg2vips( void *buf, size_t len, IMAGE *out, gboolean header_only ) return( result ); } -int -jpeg2vips_header( const char *name, IMAGE *out ) -{ - return( jpeg2vips( name, out, TRUE ) ); -} - static int isjpeg( const char *filename ) { diff --git a/libvips/include/vips/header.h b/libvips/include/vips/header.h index a4900897..3ab9f554 100644 --- a/libvips/include/vips/header.h +++ b/libvips/include/vips/header.h @@ -84,6 +84,7 @@ int vips_image_get_xoffset( VipsImage *image ); int vips_image_get_yoffset( VipsImage *image ); const char *vips_image_get_filename( VipsImage *image ); const char *vips_image_get_mode( VipsImage *image ); +void *vips_image_get_data( VipsImage *image );; void vips_image_init_fields( VipsImage *image, int xsize, int ysize, int bands, diff --git a/libvips/iofuncs/header.c b/libvips/iofuncs/header.c index 7cdd353a..e9aacdf0 100644 --- a/libvips/iofuncs/header.c +++ b/libvips/iofuncs/header.c @@ -414,6 +414,27 @@ vips_image_get_mode( VipsImage *image ) return( image->mode ); } +/** + * vips_image_get_data: + * @image: image to get data for + * + * Return a pointer to the image's pixel data, if possible. This can involve + * allocating large amounts of memory and performing a long computation. Image + * pixels are laid out in band-packed rows. + * + * See also: vips_image_wio_input(). + * + * Returns: a pointer to pixel data, if possible. + */ +void * +vips_image_get_data( VipsImage *image ) +{ + if( vips_image_wio_input( image ) ) + return( NULL ); + + return( image->data ); +} + /** * vips_image_init_fields: * @image: image to init