fix tiled tiff read
This commit is contained in:
parent
0b8c31f85e
commit
e9e23536eb
2
TODO
2
TODO
@ -20,6 +20,8 @@
|
||||
- "header fred.png" does not work, since header uses im_open() which uses
|
||||
VipsForeign
|
||||
|
||||
- "header x.tif[page=7]" does not work
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -403,14 +403,14 @@ vips_tile_cache_class_init( VipsTileCacheClass *class )
|
||||
|
||||
VIPS_ARG_INT( class, "tile_width", 3,
|
||||
_( "Tile width" ),
|
||||
_( "TIle width in pixels" ),
|
||||
_( "Tile width in pixels" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsTileCache, tile_width ),
|
||||
1, 1000000, 128 );
|
||||
|
||||
VIPS_ARG_INT( class, "tile_height", 3,
|
||||
_( "Tile height" ),
|
||||
_( "TIle height in pixels" ),
|
||||
_( "Tile height in pixels" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsTileCache, tile_height ),
|
||||
1, 1000000, 128 );
|
||||
@ -470,7 +470,7 @@ vips_tilecache( VipsImage *in, VipsImage **out, ... )
|
||||
int result;
|
||||
|
||||
va_start( ap, out );
|
||||
result = vips_call_split( "cache", ap, in, out );
|
||||
result = vips_call_split( "tilecache", ap, in, out );
|
||||
va_end( ap );
|
||||
|
||||
return( result );
|
||||
|
@ -478,7 +478,7 @@ vips_foreign_load_start_cb( VipsImage *out, void *a, void *dummy )
|
||||
*/
|
||||
if( load->disc &&
|
||||
disc_threshold &&
|
||||
(load->flags & VIPS_FOREIGN_PARTIAL) &&
|
||||
!(load->flags & VIPS_FOREIGN_PARTIAL) &&
|
||||
image_size > disc_threshold )
|
||||
if( !(load->real = vips_image_new_disc_temp( "%s.v" )) )
|
||||
return( NULL );
|
||||
|
@ -1253,6 +1253,10 @@ read_tilewise( ReadTiff *rtiff, VipsImage *out )
|
||||
VipsImage *raw;
|
||||
VipsImage *t;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "tiff2vips: read_tilewise\n" );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
/* Get tiling geometry.
|
||||
*/
|
||||
if( !tfget32( rtiff->tiff, TIFFTAG_TILEWIDTH, &rtiff->twidth ) ||
|
||||
@ -1276,7 +1280,7 @@ read_tilewise( ReadTiff *rtiff, VipsImage *out )
|
||||
|
||||
/* Process and save as VIPS.
|
||||
*/
|
||||
vips_demand_hint( out,
|
||||
vips_demand_hint( raw,
|
||||
VIPS_DEMAND_STYLE_SMALLTILE, NULL );
|
||||
if( vips_image_generate( raw,
|
||||
tiff_seq_start, tiff_fill_region, tiff_seq_stop,
|
||||
@ -1292,9 +1296,10 @@ read_tilewise( ReadTiff *rtiff, VipsImage *out )
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
if( vips_image_write( t, out ) ) {
|
||||
VIPS_UNREF( t );
|
||||
g_object_unref( t );
|
||||
return( -1 );
|
||||
}
|
||||
g_object_unref( t );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
@ -1318,6 +1323,10 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out )
|
||||
int i;
|
||||
PEL *p;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "tiff2vips: read_stripwise\n" );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
if( parse_header( rtiff, out ) )
|
||||
return( -1 );
|
||||
|
||||
@ -1471,6 +1480,7 @@ vips__tiff_read( const char *filename, VipsImage *out, int page )
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
|
||||
printf( "tiff2vips: libtiff starting for %s\n", filename );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
TIFFSetErrorHandler( vips__thandler_error );
|
||||
|
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
#define DEBUG_VERBOSE
|
||||
#define DEBUG
|
||||
*/
|
||||
|
||||
@ -90,7 +89,7 @@ vips_foreign_load_tiff_get_flags( VipsForeignLoad *load )
|
||||
VipsForeignFlags flags;
|
||||
|
||||
flags = 0;
|
||||
if( vips__istifftiled( tiff->filename ) )
|
||||
if( vips__istifftiled( tiff->filename ) )
|
||||
flags |= VIPS_FOREIGN_PARTIAL;
|
||||
|
||||
return( flags );
|
||||
|
Loading…
Reference in New Issue
Block a user