support tiffsave_buffer pyramids
add support for tiff pyramid save to memory, thanks bubba see https://github.com/jcupitt/libvips/issues/702
This commit is contained in:
parent
836b6c943b
commit
d12f8e200a
@ -13,6 +13,7 @@
|
||||
- add vips_find_trim(), search for non-background areas
|
||||
- remove lcms1 support, it had bitrotted
|
||||
- `join` tagged as seq
|
||||
- support tiffsave_buffer for pyramids, thanks bubba
|
||||
|
||||
2/8/17 started 8.5.8
|
||||
- fix transparency detection in merge, thanks Haida
|
||||
|
@ -2,6 +2,9 @@
|
||||
*
|
||||
* 14/10/16
|
||||
* - from vips2tiff.c
|
||||
*
|
||||
* 26/8/17
|
||||
* - add openout_read, to help tiffsave_buffer for pyramids
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -309,9 +312,26 @@ typedef struct _VipsTiffOpenoutBuffer {
|
||||
static tsize_t
|
||||
openout_buffer_read( thandle_t st, tdata_t data, tsize_t size )
|
||||
{
|
||||
g_assert_not_reached();
|
||||
|
||||
return( 0 );
|
||||
VipsTiffOpenoutBuffer *buffer = (VipsTiffOpenoutBuffer *) st;
|
||||
|
||||
off_t write_point;
|
||||
size_t available;
|
||||
unsigned char *from;
|
||||
|
||||
write_point = vips_dbuf_tell( &buffer->dbuf );
|
||||
from = vips_dbuf_get_write( &buffer->dbuf, &available );
|
||||
vips_dbuf_seek( &buffer->dbuf, write_point, SEEK_SET );
|
||||
|
||||
if( available < size ) {
|
||||
vips_error( "openout_buffer_read",
|
||||
"%s", _( "read beyond end of buffer" ) );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
memcpy( data, from, size );
|
||||
|
||||
vips_dbuf_seek( &buffer->dbuf, size, SEEK_CUR );
|
||||
return( size );
|
||||
}
|
||||
|
||||
static tsize_t
|
||||
|
@ -171,6 +171,8 @@
|
||||
* 29/1/17
|
||||
* - enable bigtiff automatically for large, uncompressed writes, thanks
|
||||
* AndreasSchmid1
|
||||
* 26/8/17
|
||||
* - support pyramid creation to buffer, thanks bubba
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1665,8 +1667,16 @@ wtiff_gather( Wtiff *wtiff )
|
||||
printf( "Appending layer %s ...\n", layer->lname );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
if( !(in = vips__tiff_openin( layer->lname )) )
|
||||
return( -1 );
|
||||
if( layer->lname ) {
|
||||
if( !(in = vips__tiff_openin( layer->lname )) )
|
||||
return( -1 );
|
||||
}
|
||||
else {
|
||||
if( !(in = vips__tiff_openin_buffer( wtiff->im,
|
||||
layer->buf, layer->len )) )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( wtiff_copy_tiff( wtiff, wtiff->layer->tif, in ) ) {
|
||||
TIFFClose( in );
|
||||
return( -1 );
|
||||
|
@ -299,10 +299,10 @@ vips_dbuf_truncate( VipsDbuf *dbuf )
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_dbuf_truncate:
|
||||
* vips_dbuf_tell:
|
||||
* @dbuf: the buffer
|
||||
*
|
||||
* Truncate the data so that it ends at the write point. No memory is freed.
|
||||
* Returns: the current write point
|
||||
*/
|
||||
off_t
|
||||
vips_dbuf_tell( VipsDbuf *dbuf )
|
||||
|
Loading…
Reference in New Issue
Block a user