fix icc-profiles and dzsave --no-strip
We were not copying metadata down pyramid layers in dzsave, so --no-strip didn't allow icc profiles on tiles. Thanks altert See https://github.com/libvips/libvips/issues/1879
This commit is contained in:
parent
1686725117
commit
6894159ad5
@ -6,6 +6,7 @@
|
||||
- fix tiffsave region shrink mode [imgifty]
|
||||
- add missing flushes on write to target [harukizaemon]
|
||||
- hide info messages you could get with some older glibs [kleisauke]
|
||||
- fix --no-strip on dzsave with icc-profiles [altert]
|
||||
|
||||
6/9/20 started 8.10.2
|
||||
- update magicksave/load profile handling [kelilevi]
|
||||
|
@ -613,8 +613,8 @@ write_image( VipsForeignSaveDz *dz,
|
||||
if( vips_copy( image, &t, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
/* We default to stripping all metadata. Only "no_strip" turns this
|
||||
* off. Very few people really want metadata on every tile.
|
||||
/* We default to stripping all metadata. "no_strip" turns this
|
||||
* off. Most people don't want metadata on every tile.
|
||||
*/
|
||||
vips_image_set_int( t, "hide-progress", 1 );
|
||||
if( vips_image_write_to_buffer( t, format, &buf, &len,
|
||||
@ -1312,6 +1312,13 @@ strip_init( Strip *strip, Layer *layer )
|
||||
return;
|
||||
}
|
||||
|
||||
/* The strip needs to inherit the layer's metadata.
|
||||
*/
|
||||
if( vips__image_meta_copy( strip->image, layer->image ) ) {
|
||||
strip_free( strip );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Type needs to be set so we know how to convert for save correctly.
|
||||
*/
|
||||
strip->image->Type = layer->image->Type;
|
||||
|
@ -152,6 +152,7 @@ int vips__write_extension_block( VipsImage *im, void *buf, int size );
|
||||
int vips__writehist( VipsImage *image );
|
||||
int vips__read_header_bytes( VipsImage *im, unsigned char *from );
|
||||
int vips__write_header_bytes( VipsImage *im, unsigned char *to );
|
||||
int vips__image_meta_copy( VipsImage *dst, const VipsImage *src );
|
||||
|
||||
extern GMutex *vips__global_lock;
|
||||
|
||||
|
@ -994,8 +994,8 @@ meta_cp_field( VipsMeta *meta, VipsImage *dst, void *b )
|
||||
|
||||
/* Copy meta on to dst.
|
||||
*/
|
||||
static int
|
||||
meta_cp( VipsImage *dst, const VipsImage *src )
|
||||
int
|
||||
vips__image_meta_copy( VipsImage *dst, const VipsImage *src )
|
||||
{
|
||||
if( src->meta ) {
|
||||
/* We lock with vips_image_set() to stop races in highly-
|
||||
@ -1051,7 +1051,7 @@ vips__image_copy_fields_array( VipsImage *out, VipsImage *in[] )
|
||||
* subclass loaders will sometimes write to an image.
|
||||
*/
|
||||
for( i = ni - 1; i >= 0; i-- )
|
||||
if( meta_cp( out, in[i] ) )
|
||||
if( vips__image_meta_copy( out, in[i] ) )
|
||||
return( -1 );
|
||||
|
||||
/* Merge hists first to last.
|
||||
@ -1094,7 +1094,7 @@ vips_image_set( VipsImage *image, const char *name, GValue *value )
|
||||
g_assert( value );
|
||||
|
||||
/* We lock between modifying metadata and copying metadata between
|
||||
* images, see meta_cp().
|
||||
* images, see vips__image_meta_copy().
|
||||
*
|
||||
* This prevents modification of metadata by one thread racing with
|
||||
* metadata copy on another -- this can lead to crashes in
|
||||
@ -1302,7 +1302,7 @@ vips_image_remove( VipsImage *image, const char *name )
|
||||
|
||||
if( image->meta ) {
|
||||
/* We lock between modifying metadata and copying metadata
|
||||
* between images, see meta_cp().
|
||||
* between images, see vips__image_meta_copy().
|
||||
*
|
||||
* This prevents modification of metadata by one thread
|
||||
* racing with metadata copy on another -- this can lead to
|
||||
|
@ -1026,6 +1026,13 @@ class TestForeign:
|
||||
buf = self.colour.dzsave_buffer(region_shrink="mode")
|
||||
buf = self.colour.dzsave_buffer(region_shrink="median")
|
||||
|
||||
# test no-strip ... icc profiles should be passed down
|
||||
filename = temp_filename(self.tempdir, '')
|
||||
self.colour.dzsave(filename, no_strip=True)
|
||||
|
||||
y = pyvips.Image.new_from_file(filename + "_files/0/0_0.jpeg")
|
||||
assert y.get_typeof("icc-profile-data") != 0
|
||||
|
||||
@skip_if_no("heifload")
|
||||
def test_heifload(self):
|
||||
def heif_valid(im):
|
||||
|
Loading…
Reference in New Issue
Block a user