don't clear meta before creating a pipeline
vips__image_copy_fields_array() used to wipe meta on the output before merging the input images. This broke foreign.c in some cases, since it likes setting some meta on the output before calling the subclass loaders, and they sometimes call write(). see https://github.com/jcupitt/ruby-vips/issues/93
This commit is contained in:
parent
5644296b1c
commit
bba1aba4b6
@ -190,6 +190,7 @@ int vips_image_get_string( const VipsImage *image,
|
||||
const char *name, const char **out );
|
||||
void vips_image_set_string( VipsImage *image,
|
||||
const char *name, const char *str );
|
||||
void vips_image_print_field( const VipsImage *image, const char *field );
|
||||
|
||||
int vips_image_history_printf( VipsImage *image, const char *format, ... )
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
|
@ -893,8 +893,11 @@ vips__image_copy_fields_array( VipsImage *out, VipsImage *in[] )
|
||||
|
||||
/* Need to copy last-to-first so that in0 meta will override any
|
||||
* earlier meta.
|
||||
*
|
||||
* Don't destroy the meta on out. Things like foreign.c like setting
|
||||
* image properties before calling a subclass loader, and those
|
||||
* subclass loaders will sometimes write to an image.
|
||||
*/
|
||||
vips__meta_destroy( out );
|
||||
for( i = ni - 1; i >= 0; i-- )
|
||||
if( meta_cp( out, in[i] ) )
|
||||
return( -1 );
|
||||
@ -1573,6 +1576,28 @@ vips_image_get_as_string( const VipsImage *image,
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_image_print_field:
|
||||
* @image: image to get the header field from
|
||||
* @field: field name
|
||||
*
|
||||
* Prints a field to stdout as ASCII. Handy for debugging.
|
||||
*/
|
||||
void
|
||||
vips_image_print_field( const VipsImage *image, const char *field )
|
||||
{
|
||||
char *str;
|
||||
|
||||
if( vips_image_get_as_string( image, field, &str ) ) {
|
||||
printf( "vips_image_print_field: unable to read field\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
printf( ".%s: %s\n", field, str );
|
||||
|
||||
g_free( str );
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_image_history_printf:
|
||||
* @image: add history line to this image
|
||||
|
Loading…
Reference in New Issue
Block a user