fix up im_vips2dz args

oops arg processing wasn't right
This commit is contained in:
John Cupitt 2013-06-11 14:03:14 +01:00
parent 55bfa92725
commit e15f02161e
1 changed files with 36 additions and 10 deletions

View File

@ -54,6 +54,7 @@ im_vips2dz( IMAGE *in, const char *filename )
char mode[FILENAME_MAX];
char buf[FILENAME_MAX];
int i;
VipsForeignDzLayout layout = VIPS_FOREIGN_DZ_LAYOUT_DZ;
char *suffix = ".jpeg";
int overlap = 0;
@ -62,28 +63,53 @@ im_vips2dz( IMAGE *in, const char *filename )
gboolean centre = FALSE;
VipsAngle angle = VIPS_ANGLE_0;
im_filename_split( filename, name, mode );
/* We can't use im_filename_split() --- it assumes that we have a
* filename with an extension before the ':', and filename here is
* actually a dirname.
*
* Just split on the first ':'.
*/
im_strncpy( name, filename, FILENAME_MAX );
if( (p = strchr( name, ':' )) ) {
*p = '\0';
im_strncpy( mode, p + 1, FILENAME_MAX );
}
strcpy( buf, mode );
p = &buf[0];
if( (q = im_getnextoption( &p )) )
layout = vips_enum_from_nick( "im_vips2dz",
VIPS_TYPE_FOREIGN_DZ_LAYOUT, q );
if( (q = im_getnextoption( &p )) ) {
if( (i = vips_enum_from_nick( "im_vips2dz",
VIPS_TYPE_FOREIGN_DZ_LAYOUT, q )) < 0 )
return( -1 );
layout = i;
}
if( (q = im_getnextoption( &p )) )
suffix = g_strdup( q );
if( (q = im_getnextoption( &p )) )
overlap = atoi( q );
if( (q = im_getnextoption( &p )) )
tile_size = atoi( q );
if( (q = im_getnextoption( &p )) )
depth = vips_enum_from_nick( "im_vips2dz",
VIPS_TYPE_FOREIGN_DZ_DEPTH, q );
if( (q = im_getnextoption( &p )) ) {
if( (i = vips_enum_from_nick( "im_vips2dz",
VIPS_TYPE_FOREIGN_DZ_DEPTH, q )) < 0 )
return( -1 );
depth = i;
}
if( (q = im_getnextoption( &p )) ) {
if( im_isprefix( "cen", q ) )
centre = TRUE;
}
if( (q = im_getnextoption( &p )) )
angle = vips_enum_from_nick( "im_vips2dz",
VIPS_TYPE_ANGLE, q );
if( (q = im_getnextoption( &p )) ) {
if( (i = vips_enum_from_nick( "im_vips2dz",
VIPS_TYPE_ANGLE, q )) < 0 )
return( -1 );
angle = i;
}
if( vips_dzsave( in, name,
"layout", layout,