small fixes

This commit is contained in:
John Cupitt 2011-12-03 11:50:09 +00:00
parent 24b3330487
commit c61ba6f481
4 changed files with 26 additions and 18 deletions

13
TODO
View File

@ -1,18 +1,7 @@
- does the tiff writer support "none" for the profile?
bool args should let you skip the '=', eg.
- bool args should let you skip the '=', eg.
vips copy x.jpg x.tif[tile,tile-width=1024]
try
$ vips copy x.jpg x.tif[tile=true,tilew=1024]
save image to tiff file: class `VipsForeignSaveTiff' has no property named `tilew'
VipsObject: bad object arguments
using class blurb rather than nick in error!

View File

@ -87,19 +87,24 @@ vips_foreign_save_tiff_build( VipsObject *object )
build( object ) )
return( -1 );
/* Default xres/yres to the values in the image.
/* Default xres/yres to the values from the image.
*/
if( !vips_argument_get_assigned( object, "xres" ) )
tiff->xres = save->ready->Xres * 10.0;
if( !vips_argument_get_assigned( object, "yres" ) )
tiff->yres = save->ready->Yres * 10.0;
/* resunit param overrides resunit metadata.
*/
if( !vips_argument_get_assigned( object, "resunit" ) &&
vips_image_get_typeof( save->ready,
VIPS_META_RESOLUTION_UNIT ) &&
!vips_image_get_string( save->ready,
VIPS_META_RESOLUTION_UNIT, &p ) &&
vips_isprefix( "in", p ) ) {
vips_isprefix( "in", p ) )
tiff->resunit = VIPS_FOREIGN_TIFF_RESUNIT_INCH;
if( tiff->resunit == VIPS_FOREIGN_TIFF_RESUNIT_INCH ) {
tiff->xres *= 2.54;
tiff->yres *= 2.54;
}
@ -276,8 +281,19 @@ vips_foreign_save_tiff_init( VipsForeignSaveTiff *tiff )
* vips_tiffsave:
* @in: image to save
* @filename: file to write to
* @compression; use this compression scheme
* @Q: quality factor
* @predictor; compress with this prediction
* @profile: attach this ICC profile
* @tile; set %TRUE to write a tiled tiff
* @tile_width; set tile size
* @tile_height; set tile size
* @pyramid; set %TRUE to write an image pyramid
* @squash; squash 8-bit images down to 1 bit
* @resunit; use pixels per inch or cm for the resolution
* @xres; horizontal resolution
* @yres; vertical resolution
* @bigtiff; write a BigTiff file
*
* Write a VIPS image to a file as TIFF.
*

View File

@ -125,6 +125,7 @@
* - set reduced-resolution subfile type on pyramid layers
* 2/12/11
* - turn into a write fn ready to be called from a class
* - allow "none" as a profile name
*/
/*
@ -425,8 +426,10 @@ static int
embed_profile( TiffWrite *tw, TIFF *tif )
{
if( tw->icc_profile &&
strcmp( tw->icc_profile, "none" ) != 0 &&
embed_profile_file( tif, tw->icc_profile ) )
return( -1 );
if( !tw->icc_profile &&
im_header_get_typeof( tw->im, IM_META_ICC_NAME ) &&
embed_profile_meta( tif, tw->im ) )

View File

@ -429,7 +429,7 @@ vips_object_get_argument( VipsObject *object, const char *name,
if( !(*pspec = g_object_class_find_property(
G_OBJECT_CLASS( class ), name )) ) {
vips_error( VIPS_OBJECT_CLASS( class )->description,
vips_error( VIPS_OBJECT_CLASS( class )->nickname,
_( "class `%s' has no property named `%s'" ),
G_OBJECT_TYPE_NAME( object ), name );
return( -1 );
@ -438,7 +438,7 @@ vips_object_get_argument( VipsObject *object, const char *name,
if( !(*argument_class = (VipsArgumentClass *)
vips__argument_table_lookup( class->argument_table,
*pspec )) ) {
vips_error( VIPS_OBJECT_CLASS( class )->description,
vips_error( VIPS_OBJECT_CLASS( class )->nickname,
_( "class `%s' has no vips argument named `%s'" ),
G_OBJECT_TYPE_NAME( object ), name );
return( -1 );
@ -446,7 +446,7 @@ vips_object_get_argument( VipsObject *object, const char *name,
if( argument_class &&
!(*argument_instance = vips__argument_get_instance(
*argument_class, object )) ) {
vips_error( VIPS_OBJECT_CLASS( class )->description,
vips_error( VIPS_OBJECT_CLASS( class )->nickname,
_( "vips argument `%s' has no instance" ),
G_OBJECT_TYPE_NAME( object ), name );
return( -1 );
@ -1129,7 +1129,7 @@ vips_object_class_init( VipsObjectClass *class )
class->new_from_string = vips_object_real_new_from_string;
class->to_string = vips_object_real_to_string;
class->nickname = "object";
class->description = _( "VIPS base class" );
class->description = _( "base class" );
/* Table of VipsArgumentClass ... we can just g_free() them.
*/