From a9933071eca79c024e345c37a299f20b36a424f3 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sun, 27 Nov 2011 16:03:57 -0500 Subject: [PATCH] add OpenSlide properties to image metadata --- libvips/format/openslide.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libvips/format/openslide.c b/libvips/format/openslide.c index dba304a0..42819986 100644 --- a/libvips/format/openslide.c +++ b/libvips/format/openslide.c @@ -9,6 +9,7 @@ * 27/11/11 * - fix black background in transparent areas * - no need to set *stop on fill_region() error return + * - add OpenSlide properties to image metadata */ /* @@ -61,6 +62,7 @@ static int load_header( openslide_t *osr, VipsImage *out ) { int64_t w, h; + const char * const *properties; openslide_get_layer0_dimensions( osr, &w, &h ); if( w < 0 || h < 0 ) { @@ -73,8 +75,15 @@ load_header( openslide_t *osr, VipsImage *out ) _( "image dimensions overflow int" )); return( -1 ); } + vips_image_init_fields( out, (int) w, (int) h, 4, VIPS_FORMAT_UCHAR, VIPS_CODING_NONE, VIPS_INTERPRETATION_RGB, 1.0, 1.0 ); + + for( properties = openslide_get_property_names(osr); + *properties != NULL; properties++ ) + vips_image_set_string( out, *properties, + openslide_get_property_value( osr, *properties )); + return( 0 ); }