vipsthumbnail knows about :seq mode for png
also im_open() knows about old-style embedded filename options
This commit is contained in:
parent
b52785eef7
commit
e0f31e3b4a
11
TODO
11
TODO
@ -1,5 +1,16 @@
|
||||
- add a sequential mode to all readers
|
||||
|
||||
- we need to shrink a line at a time .. also, im_shrink() could be a bit
|
||||
quicker
|
||||
|
||||
|
||||
|
||||
- vips_image_new_from_file() etc. don't allow options in file names ... should
|
||||
they have varargs instead for options? or a version which goes view
|
||||
new_from_string and does allow options?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -60,8 +60,22 @@ im_open( const char *filename, const char *mode )
|
||||
if( vips_init( "giant_banana" ) )
|
||||
vips_error_clear();
|
||||
|
||||
if( !(image = vips_image_new_mode( filename, mode )) )
|
||||
return( NULL );
|
||||
/* We have to go via the old VipsFormat system so we can support the
|
||||
* "filename:option" syntax.
|
||||
*/
|
||||
if( strcmp( mode, "r" ) == 0 ||
|
||||
strcmp( mode, "rd" ) == 0 ) {
|
||||
if( !(image = vips__deprecated_open_read( filename )) )
|
||||
return( NULL );
|
||||
}
|
||||
else if( strcmp( mode, "w" ) == 0 ) {
|
||||
if( !(image = vips__deprecated_open_write( filename )) )
|
||||
return( NULL );
|
||||
}
|
||||
else {
|
||||
if( !(image = vips_image_new_mode( filename, mode )) )
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
return( image );
|
||||
}
|
||||
|
@ -465,13 +465,13 @@ vips__png_read( const char *name, VipsImage *out, int sequential )
|
||||
png2vips_sequential( read, raw ) )
|
||||
return( -1 );
|
||||
|
||||
/* Copy to out, adding a cache.
|
||||
* Enough tiles for two complete rows.
|
||||
/* Copy to out, adding a cache. Enough tiles for two complete
|
||||
* rows.
|
||||
*/
|
||||
if( vips_tilecache( raw, &t,
|
||||
"tile_width", raw->Xsize,
|
||||
"tile_height", 32,
|
||||
"max_tiles", 10,
|
||||
"tile_height", VIPS__TILE_HEIGHT,
|
||||
"max_tiles", 2,
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
if( vips_image_write( t, out ) ) {
|
||||
|
@ -21,6 +21,8 @@
|
||||
* - oops sharpening was turning off for integer shrinks, thanks Nicolas
|
||||
* 30/7/10
|
||||
* - use new "rd" mode rather than our own open via disc
|
||||
* 8/2/12
|
||||
* - use :seq mode for png images
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -326,6 +328,7 @@ static int
|
||||
thumbnail( const char *filename )
|
||||
{
|
||||
VipsFormatClass *format;
|
||||
char buf[FILENAME_MAX];
|
||||
|
||||
if( verbose )
|
||||
printf( "thumbnailing %s\n", filename );
|
||||
@ -340,7 +343,6 @@ thumbnail( const char *filename )
|
||||
if( strcmp( VIPS_OBJECT_CLASS( format )->nickname, "jpeg" ) == 0 ) {
|
||||
IMAGE *im;
|
||||
int shrink;
|
||||
char buf[FILENAME_MAX];
|
||||
|
||||
/* This will just read in the header and is quick.
|
||||
*/
|
||||
@ -365,6 +367,15 @@ thumbnail( const char *filename )
|
||||
|
||||
return( thumbnail2( buf ) );
|
||||
}
|
||||
else if( strcmp( VIPS_OBJECT_CLASS( format )->nickname, "png" ) == 0 ) {
|
||||
char buf[FILENAME_MAX];
|
||||
|
||||
if( verbose )
|
||||
printf( "enabling sequential mode for png load\n" );
|
||||
im_snprintf( buf, FILENAME_MAX, "%s:seq", filename );
|
||||
|
||||
return( thumbnail2( buf ) );
|
||||
}
|
||||
else
|
||||
return( thumbnail2( filename ) );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user