Merge branch 'glib-logging'

This commit is contained in:
John Cupitt 2017-01-04 14:58:11 +00:00
commit c4640b61c7
46 changed files with 283 additions and 351 deletions

View File

@ -17,6 +17,7 @@
- added #defines for VIPS_SONAME, VIPS_LIBRARY_CURRENT, VIPS_LIBRARY_REVISION,
VIPS_LIBRARY_AGE
- better support for bscale / bzero in fits images
- deprecate vips_warn() / vips_info(); use g_warning() / g_info() instead
8/12/16 started 8.4.5
- allow libgsf-1.14.26 to help centos, thanks tdiprima

View File

@ -350,7 +350,7 @@ set_property( VipsObject *object, const char *name, const GValue *value )
if( vips_object_get_argument( object, name,
&pspec, &argument_class, &argument_instance ) ) {
vips_warn( NULL, "%s", vips_error_buffer() );
g_warning( "%s", vips_error_buffer() );
vips_error_clear();
return;
}
@ -364,7 +364,7 @@ set_property( VipsObject *object, const char *name, const GValue *value )
if( (enum_value = vips_enum_from_nick( object_class->nickname,
pspec_type, g_value_get_string( value ) )) < 0 ) {
vips_warn( NULL, "%s", vips_error_buffer() );
g_warning( "%s", vips_error_buffer() );
vips_error_clear();
return;
}

View File

@ -208,6 +208,14 @@ rm t1.v
leak-test on exit, and also display an estimate of peak memory use.
</para>
</listitem>
<listitem>
<para>
Set <code>G_MESSAGES_DEBUG=VIPS</code> and GLib will display
informational and debug messages from libvips.
</para>
</listitem>
</itemizedlist>
</para>

View File

@ -165,9 +165,11 @@ vips_measure_build( VipsObject *object )
*/
if( dev * 5 > VIPS_FABS( avg ) &&
VIPS_FABS( avg ) > 3 )
vips_warn( class->nickname,
_( "patch %d x %d, band %d: "
"avg = %g, sdev = %g" ),
g_warning( _( "%s: "
"patch %d x %d, "
"band %d: "
"avg = %g, sdev = %g" ),
class->nickname,
i, j, b, avg, dev );
*VIPS_MATRIX( measure->out,

View File

@ -193,9 +193,9 @@ static int
icc_error( int code, const char *text )
{
if( code == LCMS_ERRC_WARNING )
vips_warn( "VipsIcc", "%s", text );
g_warning( "%s", text );
else
vips_error( "VipsIcc", "%s", text );
vips_error( "VipsIcc", text );
return( 0 );
}
@ -452,9 +452,9 @@ vips_check_intent( const char *domain,
{
if( profile &&
!cmsIsIntentSupported( profile, intent, direction ) )
vips_warn( domain,
_( "intent %d (%s) not supported by "
g_warning( _( "%s: intent %d (%s) not supported by "
"%s profile; falling back to default intent" ),
domain,
intent, vips_enum_nick( VIPS_TYPE_INTENT, intent ),
direction == LCMS_USED_AS_INPUT ?
_( "input" ) : _( "output" ) );
@ -542,7 +542,7 @@ vips_image_expected_bands( VipsImage *image )
}
static cmsHPROFILE
vips_icc_load_profile_image( const char *domain, VipsImage *image )
vips_icc_load_profile_image( VipsImage *image )
{
void *data;
size_t data_length;
@ -554,15 +554,15 @@ vips_icc_load_profile_image( const char *domain, VipsImage *image )
if( vips_image_get_blob( image, VIPS_META_ICC_NAME,
&data, &data_length ) ||
!(profile = cmsOpenProfileFromMem( data, data_length )) ) {
vips_warn( domain, "%s", _( "corrupt embedded profile" ) );
g_warning( "%s", _( "corrupt embedded profile" ) );
return( NULL );
}
if( vips_image_expected_bands( image ) !=
vips_icc_profile_needs_bands( profile ) ) {
VIPS_FREEF( cmsCloseProfile, profile );
vips_warn( domain,
"%s", _( "embedded profile incompatible with image" ) );
g_warning( "%s",
_( "embedded profile incompatible with image" ) );
return( NULL );
}
@ -584,8 +584,7 @@ vips_icc_load_profile_file( const char *domain,
if( vips_image_expected_bands( image ) !=
vips_icc_profile_needs_bands( profile ) ) {
VIPS_FREEF( cmsCloseProfile, profile );
vips_warn( domain,
_( "profile \"%s\" incompatible with image" ),
g_warning( _( "profile \"%s\" incompatible with image" ),
filename );
return( NULL );
}
@ -615,8 +614,7 @@ vips_icc_import_build( VipsObject *object )
if( code->in &&
(import->embedded ||
!import->input_profile_filename) )
icc->in_profile = vips_icc_load_profile_image( class->nickname,
code->in );
icc->in_profile = vips_icc_load_profile_image( code->in );
if( !icc->in_profile &&
code->in &&
@ -1027,8 +1025,7 @@ vips_icc_transform_build( VipsObject *object )
if( code->in &&
(transform->embedded ||
!transform->input_profile_filename) )
icc->in_profile = vips_icc_load_profile_image( class->nickname,
code->in );
icc->in_profile = vips_icc_load_profile_image( code->in );
if( !icc->in_profile &&
code->in &&

View File

@ -126,11 +126,9 @@ vips_cast_preeval( VipsImage *image, VipsProgress *progress, VipsCast *cast )
static void
vips_cast_posteval( VipsImage *image, VipsProgress *progress, VipsCast *cast )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( cast );
if( cast->overflow || cast->underflow )
vips_warn( class->nickname,
_( "%d underflows and %d overflows detected" ),
if( cast->overflow ||
cast->underflow )
g_warning( _( "%d underflows and %d overflows detected" ),
cast->underflow, cast->overflow );
}

View File

@ -177,7 +177,7 @@ vips_copy_build( VipsObject *object )
return( -1 );
if( copy->swap )
vips_warn( class->nickname, "%s",
g_warning( "%s",
_( "copy swap is deprecated, use byteswap instead" ) );
if( vips_image_pipelinev( conversion->out,

View File

@ -124,7 +124,6 @@ vips_sequential_generate( VipsRegion *or,
void *seq, void *a, void *b, gboolean *stop )
{
VipsSequential *sequential = (VipsSequential *) b;
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( sequential );
VipsRect *r = &or->valid;
VipsRegion *ir = (VipsRegion *) seq;
@ -132,8 +131,7 @@ vips_sequential_generate( VipsRegion *or,
g_thread_self(), r->top, r->height );
if( sequential->trace )
vips_info( class->nickname,
"request for line %d, height %d",
g_info( "request for line %d, height %d",
r->top, r->height );
VIPS_GATE_START( "vips_sequential_generate: wait" );

View File

@ -605,7 +605,6 @@ vips_tile_cache_gen( VipsRegion *or,
{
VipsRegion *in = (VipsRegion *) seq;
VipsBlockCache *cache = (VipsBlockCache *) b;
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( cache );
VipsRect *r = &or->valid;
VipsTile *tile;
@ -702,8 +701,7 @@ vips_tile_cache_gen( VipsRegion *or,
"vips_tile_cache_gen: "
"error on tile %p\n", tile );
vips_warn( class->nickname,
_( "error in tile %d x %d" ),
g_warning( _( "error in tile %d x %d" ),
tile->pos.left, tile->pos.top );
vips_region_black( tile->region );

View File

@ -860,7 +860,7 @@ intize_to_fixed_point( VipsImage *in, int *out )
for( i = 0; i < ne; i++ )
if( scaled[i] >= 4.0 ||
scaled[i] < -4 ) {
vips_info( "intize_to_fixed_point",
g_info( "intize_to_fixed_point: "
"out of range for vector path" );
return( -1 );
}
@ -880,7 +880,7 @@ intize_to_fixed_point( VipsImage *in, int *out )
/* 0.1 is a 10% error.
*/
if( total_error > 0.1 ) {
vips_info( "intize_to_fixed_point", "too many underflows" );
g_info( "intize_to_fixed_point: too many underflows" );
return( -1 );
}
@ -906,7 +906,6 @@ intize_to_fixed_point( VipsImage *in, int *out )
static int
vips_convi_build( VipsObject *object )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConvolution *convolution = (VipsConvolution *) object;
VipsConvi *convi = (VipsConvi *) object;
VipsImage **t = (VipsImage **) vips_object_local_array( object, 4 );
@ -941,7 +940,7 @@ vips_convi_build( VipsObject *object )
!intize_to_fixed_point( M, convi->fixed ) &&
!vips_convi_compile( convi, in ) ) {
generate = vips_convi_gen_vector;
vips_info( class->nickname, "using vector path" );
g_info( "using vector path" );
}
else
vips_convi_compile_free( convi );
@ -980,7 +979,7 @@ vips_convi_build( VipsObject *object )
}
generate = vips_convi_gen;
vips_info( class->nickname, "using C path" );
g_info( "using C path" );
}
g_object_set( convi, "out", vips_image_new(), NULL );

View File

@ -67,7 +67,6 @@ G_DEFINE_TYPE( VipsGaussblur, vips_gaussblur, VIPS_TYPE_OPERATION );
static int
vips_gaussblur_build( VipsObject *object )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsGaussblur *gaussblur = (VipsGaussblur *) object;
VipsImage **t = (VipsImage **) vips_object_local_array( object, 2 );
@ -85,7 +84,7 @@ vips_gaussblur_build( VipsObject *object )
vips_matrixprint( t[0], NULL );
#endif /*DEBUG*/
vips_info( class->nickname, "gaussblur mask width %d", t[0]->Xsize );
g_info( "gaussblur mask width %d", t[0]->Xsize );
if( vips_convsep( gaussblur->in, &t[1], t[0],
"precision", gaussblur->precision,

View File

@ -724,3 +724,79 @@ vips_check_bands_3ormore( const char *domain, VipsImage *im )
{
return( vips_check_bands_atleast( domain, im, 3 ) );
}
/* The old vips_info() stuff, now replaced by g_warning() / g_info().
*/
int vips__info = 0;
void
vips_info_set( gboolean info )
{
vips__info = info;
if( info ) {
const char *old;
char *new;
old = g_getenv( "G_MESSAGES_DEBUG" );
if( !old )
old = "";
new = g_strdup_printf( "%s VIPS", old );
g_setenv( "G_MESSAGES_DEBUG", new, TRUE );
g_free( new );
}
}
void
vips_vinfo( const char *domain, const char *fmt, va_list ap )
{
if( vips__info ) {
g_mutex_lock( vips__global_lock );
(void) fprintf( stderr, _( "%s: " ), _( "info" ) );
if( domain )
(void) fprintf( stderr, _( "%s: " ), domain );
(void) vfprintf( stderr, fmt, ap );
(void) fprintf( stderr, "\n" );
g_mutex_unlock( vips__global_lock );
}
}
void
vips_info( const char *domain, const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
vips_vinfo( domain, fmt, ap );
va_end( ap );
}
void
vips_vwarn( const char *domain, const char *fmt, va_list ap )
{
if( !g_getenv( "IM_WARNING" ) &&
!g_getenv( "VIPS_WARNING" ) ) {
g_mutex_lock( vips__global_lock );
(void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) );
if( domain )
(void) fprintf( stderr, _( "%s: " ), domain );
(void) vfprintf( stderr, fmt, ap );
(void) fprintf( stderr, "\n" );
g_mutex_unlock( vips__global_lock );
}
if( vips__fatal )
vips_error_exit( "vips__fatal" );
}
void
vips_warn( const char *domain, const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
vips_vwarn( domain, fmt, ap );
va_end( ap );
}

View File

@ -195,8 +195,7 @@ read_double( FILE *fp, const char whitemap[256], const char sepmap[256],
/* Only a warning, since (for example) exported spreadsheets
* will often have text or date fields.
*/
vips_warn( "csv2vips",
_( "error parsing number, line %d, column %d" ),
g_warning( _( "error parsing number, line %d, column %d" ),
lineno, colno );
if( fail )
return( EOF );

View File

@ -1997,8 +1997,7 @@ vips_foreign_save_dz_build( VipsObject *object )
#ifndef HAVE_GSF_DEFLATE_LEVEL
if( dz->compression > 0 ) {
vips_warn( class->nickname, "%s",
_( "deflate-level not supported by libgsf, "
g_warning( _( "deflate-level not supported by libgsf, "
"using default compression" ) );
dz->compression = -1;
}

View File

@ -846,9 +846,9 @@ vips_foreign_load_build( VipsObject *object )
if( (flags & VIPS_FOREIGN_PARTIAL) &&
(flags & VIPS_FOREIGN_SEQUENTIAL) ) {
vips_warn( class->nickname, "%s",
g_warning( "%s",
_( "VIPS_FOREIGN_PARTIAL and VIPS_FOREIGN_SEQUENTIAL "
"both set -- using SEQUENTIAL" ) );
"both set -- using SEQUENTIAL" ) );
flags ^= VIPS_FOREIGN_PARTIAL;
}
@ -865,12 +865,10 @@ vips_foreign_load_build( VipsObject *object )
build( object ) )
return( -1 );
if( load->sequential ) {
vips_warn( class->nickname, "%s",
_( "ignoring deprecated \"sequential\" mode" ) );
vips_warn( class->nickname, "%s",
_( "please use \"access\" instead" ) );
}
if( load->sequential )
g_warning( "%s",
_( "ignoring deprecated \"sequential\" mode -- "
"please use \"access\" instead" ) );
g_object_set( object, "out", vips_image_new(), NULL );

View File

@ -359,7 +359,6 @@ static void
vips_foreign_load_gif_render_line( VipsForeignLoadGif *gif,
int width, VipsPel * restrict q, VipsPel * restrict p )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif );
ColorMapObject *map = gif->file->Image.ColorMap ?
gif->file->Image.ColorMap : gif->file->SColorMap;
@ -369,8 +368,7 @@ vips_foreign_load_gif_render_line( VipsForeignLoadGif *gif,
VipsPel v = p[x];
if( v >= map->ColorCount ) {
vips_warn( class->nickname,
"%s", _( "pixel value out of range" ) );
g_warning( "%s", _( "pixel value out of range" ) );
continue;
}

View File

@ -194,10 +194,9 @@ readjpeg_free( ReadJpeg *jpeg )
result = 0;
if( jpeg->eman.pub.num_warnings != 0 ) {
vips_warn( "VipsJpeg",
_( "read gave %ld warnings" ),
g_warning( _( "read gave %ld warnings" ),
jpeg->eman.pub.num_warnings );
vips_warn( NULL, "%s", vips_error_buffer() );
g_warning( "%s", vips_error_buffer() );
/* Make the message only appear once.
*/
@ -615,8 +614,7 @@ res_from_exif( VipsImage *im, ExifData *ed )
break;
default:
vips_warn( "VipsJpeg",
"%s", _( "unknown EXIF resolution unit" ) );
g_warning( "%s", _( "unknown EXIF resolution unit" ) );
return( -1 );
}
@ -830,8 +828,7 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
break;
default:
vips_warn( "VipsJpeg",
"%s", _( "unknown JFIF resolution unit" ) );
g_warning( "%s", _( "unknown JFIF resolution unit" ) );
break;
}

View File

@ -799,9 +799,8 @@ vips__ppm_save( VipsImage *in, const char *filename,
if( ascii &&
in->BandFmt == VIPS_FORMAT_FLOAT ) {
vips_warn( "vips2ppm",
"%s", _( "float images must be binary -- "
"disabling ascii" ) );
g_warning( "%s",
_( "float images must be binary -- disabling ascii" ) );
ascii = FALSE;
}
@ -810,8 +809,8 @@ vips__ppm_save( VipsImage *in, const char *filename,
if( squash &&
(in->Bands != 1 ||
in->BandFmt != VIPS_FORMAT_UCHAR) ) {
vips_warn( "vips2ppm",
"%s", _( "can only squash 1 band uchar images -- "
g_warning( "%s",
_( "can only squash 1 band uchar images -- "
"disabling squash" ) );
squash = FALSE;
}

View File

@ -58,8 +58,7 @@
#include "tiff.h"
/* Handle TIFF errors here. Shared with vips2tiff.c. These can be called from
* more than one thread, but vips_error and vips_warn have mutexes in, so that's
* OK.
* more than one thread.
*/
static void
vips__thandler_error( const char *module, const char *fmt, va_list ap )
@ -73,10 +72,7 @@ vips__thandler_error( const char *module, const char *fmt, va_list ap )
static void
vips__thandler_warning( const char *module, const char *fmt, va_list ap )
{
char buf[256];
vips_vsnprintf( buf, 256, fmt, ap );
vips_warn( module, "%s", buf );
g_logv( G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, fmt, ap );
}
/* Call this during startup. Other libraries may be using libtiff and we want

View File

@ -387,7 +387,7 @@ get_resolution( TIFF *tiff, VipsImage *out )
}
}
else {
vips_warn( "tiff2vips", _( "no resolution information for "
g_warning( _( "no resolution information for "
"TIFF image \"%s\" -- defaulting to 1 pixel per mm" ),
TIFFFileName( tiff ) );
x = 1.0;
@ -1041,7 +1041,7 @@ rtiff_parse_palette( Rtiff *rtiff, VipsImage *out )
read->blue8[i] = read->blue16[i] >> 8;
}
else {
vips_warn( "tiff2vips", "%s", _( "assuming 8-bit palette" ) );
g_warning( "%s", _( "assuming 8-bit palette" ) );
for( i = 0; i < len; i++ ) {
read->red8[i] = read->red16[i] & 0xff;

View File

@ -495,8 +495,7 @@ vips__set_exif_resolution( ExifData *ed, VipsImage *im )
break;
default:
vips_warn( "VipsJpeg",
"%s", _( "unknown EXIF resolution unit" ) );
g_warning( "%s", _( "unknown EXIF resolution unit" ) );
return( 0 );
}
@ -626,7 +625,7 @@ vips_exif_image_field( VipsImage *image,
/* value must be a string.
*/
if( vips_image_get_string( image, field, &string ) ) {
vips_warn( "VipsJpeg", _( "bad exif meta \"%s\"" ), field );
g_warning( _( "bad exif meta \"%s\"" ), field );
return( NULL );
}
@ -636,12 +635,12 @@ vips_exif_image_field( VipsImage *image,
for( ; isdigit( *p ); p++ )
;
if( *p != '-' ) {
vips_warn( "VipsJpeg", _( "bad exif meta \"%s\"" ), field );
g_warning( _( "bad exif meta \"%s\"" ), field );
return( NULL );
}
if( !(tag = exif_tag_from_name( p + 1 )) ) {
vips_warn( "VipsJpeg", _( "bad exif meta \"%s\"" ), field );
g_warning( _( "bad exif meta \"%s\"" ), field );
return( NULL );
}
@ -764,7 +763,7 @@ write_blob( Write *write, const char *field, int app )
* For now, just ignore oversize objects and warn.
*/
if( data_length > 65530 )
vips_warn( "VipsJpeg", _( "field \"%s\" is too large "
g_warning( _( "field \"%s\" is too large "
"for a single JPEG marker, ignoring" ),
field );
else {
@ -1082,8 +1081,7 @@ write_vips( Write *write, int qfac, const char *profile,
write->cinfo.optimize_coding = TRUE;
}
else
vips_warn( "vips2jpeg",
"%s", _( "trellis_quant unsupported" ) );
g_warning( "%s", _( "trellis_quant unsupported" ) );
}
/* Apply overshooting to samples with extreme values e.g. 0 & 255
@ -1095,8 +1093,8 @@ write_vips( Write *write, int qfac, const char *profile,
jpeg_c_set_bool_param( &write->cinfo,
JBOOLEAN_OVERSHOOT_DERINGING, TRUE );
else
vips_warn( "vips2jpeg",
"%s", _( "overshoot_deringing unsupported" ) );
g_warning( "%s",
_( "overshoot_deringing unsupported" ) );
}
/* Split the spectrum of DCT coefficients into separate scans.
* Requires progressive output. Must be set before
@ -1109,12 +1107,12 @@ write_vips( Write *write, int qfac, const char *profile,
jpeg_c_set_bool_param( &write->cinfo,
JBOOLEAN_OPTIMIZE_SCANS, TRUE );
else
vips_warn( "vips2jpeg",
"%s", _( "Ignoring optimize_scans" ) );
g_warning( "%s",
_( "ignoring optimize_scans" ) );
}
else
vips_warn( "vips2jpeg", "%s",
_( "Ignoring optimize_scans for baseline" ) );
g_warning( "%s",
_( "ignoring optimize_scans for baseline" ) );
}
/* Use predefined quantization table.
@ -1125,22 +1123,21 @@ write_vips( Write *write, int qfac, const char *profile,
jpeg_c_set_int_param( &write->cinfo,
JINT_BASE_QUANT_TBL_IDX, quant_table );
else
vips_warn( "vips2jpeg",
"%s", _( "Setting quant_table unsupported" ) );
g_warning( "%s",
_( "setting quant_table unsupported" ) );
}
#else
/* Using jpeglib.h without extension parameters, warn of ignored
* options.
*/
if( trellis_quant )
vips_warn( "vips2jpeg", "%s", _( "Ignoring trellis_quant" ) );
g_warning( "%s", _( "ignoring trellis_quant" ) );
if( overshoot_deringing )
vips_warn( "vips2jpeg",
"%s", _( "Ignoring overshoot_deringing" ) );
g_warning( "%s", _( "ignoring overshoot_deringing" ) );
if( optimize_scans )
vips_warn( "vips2jpeg", "%s", _( "Ignoring optimize_scans" ) );
g_warning( "%s", _( "ignoring optimize_scans" ) );
if( quant_table > 0 )
vips_warn( "vips2jpeg", "%s", _( "Ignoring quant_table" ) );
g_warning( "%s", _( "ignoring quant_table" ) );
#endif
/* Set compression quality. Must be called after setting params above.

View File

@ -464,8 +464,7 @@ wtiff_embed_ipct( Wtiff *wtiff, TIFF *tif )
* long, not byte.
*/
if( data_length & 3 ) {
vips_warn( "vips2tiff",
"%s", _( "rounding up IPCT data length" ) );
g_warning( "%s", _( "rounding up IPCT data length" ) );
data_length /= 4;
data_length += 1;
}
@ -958,8 +957,8 @@ wtiff_new( VipsImage *im, const char *filename,
/* We can't pyramid toilet roll images.
*/
if( wtiff->pyramid ) {
vips_warn( "vips2tiff",
"%s", _( "can't pyramid multi page images --- "
g_warning( "%s",
_( "can't pyramid multi page images --- "
"disabling pyramid" ) );
wtiff->pyramid = FALSE;
}
@ -995,16 +994,16 @@ wtiff_new( VipsImage *im, const char *filename,
(im->Coding != VIPS_CODING_NONE ||
im->BandFmt != VIPS_FORMAT_UCHAR ||
im->Bands != 1) ) {
vips_warn( "vips2tiff",
"%s", _( "can only squash 1 band uchar images -- "
g_warning( "%s",
_( "can only squash 1 band uchar images -- "
"disabling squash" ) );
wtiff->onebit = 0;
}
if( wtiff->onebit &&
wtiff->compression == COMPRESSION_JPEG ) {
vips_warn( "vips2tiff",
"%s", _( "can't have 1-bit JPEG -- disabling JPEG" ) );
g_warning( "%s",
_( "can't have 1-bit JPEG -- disabling JPEG" ) );
wtiff->compression = COMPRESSION_NONE;
}
@ -1014,8 +1013,8 @@ wtiff_new( VipsImage *im, const char *filename,
(im->Coding != VIPS_CODING_NONE ||
vips_band_format_iscomplex( im->BandFmt ) ||
im->Bands > 2) ) {
vips_warn( "vips2tiff",
"%s", _( "can only save non-complex greyscale images "
g_warning( "%s",
_( "can only save non-complex greyscale images "
"as miniswhite -- disabling miniswhite" ) );
wtiff->miniswhite = FALSE;
}

View File

@ -161,11 +161,9 @@ write_webp( WebPPicture *pic, VipsImage *in,
pic->use_argb = lossless || near_lossless || smart_subsample;
#else
if( lossless || near_lossless )
vips_warn( "vips2webp",
"%s", _( "lossless unsupported" ) );
g_warning( "%s", _( "lossless unsupported" ) );
if( alpha_q != 100 )
vips_warn( "vips2webp",
"%s", _( "alpha_q unsupported" ) );
g_warning( "%s", _( "alpha_q unsupported" ) );
#endif
#if WEBP_ENCODER_ABI_VERSION >= 0x0209
@ -175,11 +173,9 @@ write_webp( WebPPicture *pic, VipsImage *in,
config.preprocessing |= 4;
#else
if( near_lossless )
vips_warn( "vips2webp",
"%s", _( "near_lossless unsupported" ) );
g_warning( "%s", _( "near_lossless unsupported" ) );
if( smart_subsample )
vips_warn( "vips2webp",
"%s", _( "smart_subsample unsupported" ) );
g_warning( "%s", _( "smart_subsample unsupported" ) );
#endif
if( !WebPValidateConfig( &config ) ) {

View File

@ -106,11 +106,8 @@ static void
vips_maplut_posteval( VipsImage *image, VipsProgress *progress,
VipsMaplut *maplut )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( maplut );
if( maplut->overflow )
vips_warn( class->nickname,
_( "%d overflows detected" ), maplut->overflow );
g_warning( _( "%d overflows detected" ), maplut->overflow );
}
/* Our sequence value: the region this sequence is using, and local stats.

View File

@ -284,6 +284,14 @@ int im_plotpoint( IMAGE *im, int x, int y, PEL *pel );
int im_smudge( IMAGE *image, int ix, int iy, VipsRect *r );
int im_smear( IMAGE *im, int ix, int iy, VipsRect *r );
void vips_warn( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void vips_vwarn( const char *domain, const char *fmt, va_list ap );
void vips_info_set( gboolean info );
void vips_info( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void vips_vinfo( const char *domain, const char *fmt, va_list ap );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -50,13 +50,6 @@ void vips_verror_system( int err, const char *domain,
const char *fmt, va_list ap );
void vips_error_g( GError **error );
void vips_g_error( GError **error );
void vips_warn( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void vips_vwarn( const char *domain, const char *fmt, va_list ap );
void vips_info_set( gboolean info );
void vips_info( const char *domain, const char *fmt, ... )
__attribute__((format(printf, 2, 3)));
void vips_vinfo( const char *domain, const char *fmt, va_list ap );
void vips_error_exit( const char *fmt, ... )
__attribute__((noreturn, format(printf, 1, 2)));

View File

@ -135,6 +135,15 @@ G_STMT_START { \
} \
} G_STMT_END
/* The g_info() macro was added in 2.40.
*/
#ifndef g_info
/* Hopefully we have varargs macros. Maybe revisit this.
*/
#define g_info(...) \
g_log( G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__ )
#endif
/* Various integer range clips. Record over/under flows.
*/
#define VIPS_CLIP_UCHAR( V, SEQ ) \

View File

@ -166,12 +166,10 @@ extern "C" {
#define VIPS_INIT( ARGV0 ) \
(vips_version( 3 ) - vips_version( 5 ) != \
VIPS_LIBRARY_CURRENT - VIPS_LIBRARY_AGE ? ( \
vips_info( "vips_init", "ABI mismatch" ), \
vips_info( "vips_init", \
"library has ABI version %d", \
g_warning( "ABI mismatch" ), \
g_warning( "library has ABI version %d", \
vips_version( 3 ) - vips_version( 5 ) ), \
vips_info( "vips_init", \
"application needs ABI version %d", \
g_warning( "application needs ABI version %d", \
VIPS_LIBRARY_CURRENT - VIPS_LIBRARY_AGE ), \
vips_error( "vips_init", "ABI mismatch" ), \
-1 ) : \

View File

@ -103,12 +103,29 @@
*
* The domain argument most of these functions take is not localised and is
* supposed to indicate the component which failed.
*
* libvips uses g_warning() and g_info() to send warning and information
* messages to the user. You can use the usual glib mechanisms to display or
* divert these messages. For example, info messages are hidden by default, but
* you can see them with:
*
* |[
* $ G_MESSAGES_DEBUG=VIPS vipsthumbnail k2.jpg
* VIPS-INFO: thumbnailing k2.jpg
* VIPS-INFO: selected loader is VipsForeignLoadJpegFile
* VIPS-INFO: input size is 1450 x 2048
* VIPS-INFO: loading jpeg with factor 8 pre-shrink
* VIPS-INFO: converting to processing space srgb
* VIPS-INFO: residual reducev by 0.5
* VIPS-INFO: 13 point mask
* VIPS-INFO: using vector path
* VIPS-INFO: residual reduceh by 0.5
* VIPS-INFO: 13 point mask
* VIPS-INFO: thumbnailing k2.jpg as ./tn_k2.jpg
* ]|
*
*/
/* Show info messages. Handy for debugging.
*/
int vips__info = 0;
/* Make global array to keep the error message buffer.
*/
#define VIPS_MAX_ERROR (10240)
@ -371,125 +388,6 @@ vips_error_clear( void )
g_mutex_unlock( vips__global_lock );
}
/**
* vips_info_set:
* @info: %TRUE to enable info messages
*
* If set, vips will output various informative messages to stderr as it works.
*
* See also: vips_info().
*/
void
vips_info_set( gboolean info )
{
vips__info = info;
}
/**
* vips_vinfo:
* @domain: the source of the message
* @fmt: printf()-style format string for the message
* @ap: arguments to the format string
*
* Sends a formatted informational message to stderr if the --vips-info flag
* has been given to the program, or the environment variable VIPS_INFO has been
* defined, or if vips_info_set() has been called.
*
* Informational messages are used to report details about the operation of
* functions.
*
* See also: vips_info(), vips_info_set(), vips_warn().
*/
void
vips_vinfo( const char *domain, const char *fmt, va_list ap )
{
if( vips__info ) {
g_mutex_lock( vips__global_lock );
(void) fprintf( stderr, _( "%s: " ), _( "info" ) );
if( domain )
(void) fprintf( stderr, _( "%s: " ), domain );
(void) vfprintf( stderr, fmt, ap );
(void) fprintf( stderr, "\n" );
g_mutex_unlock( vips__global_lock );
}
}
/**
* vips_info:
* @domain: the source of the diagnostic message
* @fmt: printf()-style format string for the message
* @...: arguments to the format string
*
* Sends a formatted informational message to stderr if the --vips-info flag
* has been given to the program or the environment variable VIPS_INFO has been
* defined, or if vips_info_set() has been called.
*
* Informational messages are used to report details about the operation of
* functions.
*
* See also: vips_info_set(), vips_vinfo(), vips_warn().
*/
void
vips_info( const char *domain, const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
vips_vinfo( domain, fmt, ap );
va_end( ap );
}
/**
* vips_vwarn:
* @domain: the source of the warning message
* @fmt: printf()-style format string for the message
* @ap: arguments to the format string
*
* Exactly as vips_warn(), but takes a va_list argument.
*
* See also: vips_warn().
*/
void
vips_vwarn( const char *domain, const char *fmt, va_list ap )
{
if( !g_getenv( "IM_WARNING" ) &&
!g_getenv( "VIPS_WARNING" ) ) {
g_mutex_lock( vips__global_lock );
(void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) );
if( domain )
(void) fprintf( stderr, _( "%s: " ), domain );
(void) vfprintf( stderr, fmt, ap );
(void) fprintf( stderr, "\n" );
g_mutex_unlock( vips__global_lock );
}
if( vips__fatal )
vips_error_exit( "vips__fatal" );
}
/**
* vips_warn:
* @domain: the source of the warning message
* @fmt: printf()-style format string for the message
* @...: arguments to the format string
*
* Sends a formatted warning message to stderr. If you define the
* environment variable VIPS_WARNING, these message are supressed.
*
* Warning messages are used to report things like overflow counts.
*
* See also: vips_info(), vips_vwarn().
*/
void
vips_warn( const char *domain, const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
vips_vwarn( domain, fmt, ap );
va_end( ap );
}
/**
* vips_error_exit:
* @fmt: printf()-style format string for the message

View File

@ -143,8 +143,7 @@ vips_thread_profile_save( VipsThreadProfile *profile )
vips__file_open_write( "vips-profile.txt", TRUE );
if( !vips__thread_fp ) {
g_mutex_unlock( vips__global_lock );
vips_warn( "VipsGate",
"%s", "unable to create profile log" );
g_warning( "unable to create profile log" );
return;
}
@ -204,8 +203,7 @@ vips__thread_profile_init_cb( VipsThreadProfile *profile )
* been called.
*/
if( vips__thread_profile )
vips_warn( "VipsGate",
"discarding unsaved state for thread %p --- "
g_warning( "discarding unsaved state for thread %p --- "
"call vips_thread_shutdown() for this thread",
profile->thread );

View File

@ -411,7 +411,7 @@ vips_image_pipelinev( VipsImage *image, VipsDemandStyle hint, ... )
;
va_end( ap );
if( i == MAX_IMAGES ) {
vips_warn( "vips_image_pipeline", "%s", _( "too many images" ) );
g_warning( "%s", _( "too many images" ) );
/* Make sure we have a sentinel there.
*/

View File

@ -1006,8 +1006,7 @@ vips_image_build( VipsObject *object )
* still be able to process it without coredumps.
*/
if( image->file_length > sizeof_image )
vips_warn( "VipsImage",
_( "%s is longer than expected" ),
g_warning( _( "%s is longer than expected" ),
image->filename );
break;
@ -2590,9 +2589,8 @@ vips_image_write_to_memory( VipsImage *in, size_t *size_out )
vips_error( "vips_image_write_to_memory",
_( "out of memory --- size == %dMB" ),
(int) (size / (1024.0 * 1024.0)) );
vips_warn( "vips_image_write_to_memory",
_( "out of memory --- size == %dMB" ),
(int) (size / (1024.0*1024.0)) );
g_warning( _( "out of memory --- size == %dMB" ),
(int) (size / (1024.0 * 1024.0)) );
return( NULL );
}
@ -3143,8 +3141,7 @@ vips_image_wio_input( VipsImage *image )
* generate from this image.
*/
if( image->regions )
vips_warn( "vips_image_wio_input", "%s",
"rewinding image with active regions" );
g_warning( "rewinding image with active regions" );
break;

View File

@ -226,10 +226,8 @@ vips_load_plugins( const char *fmt, ... )
module = g_module_open( path, G_MODULE_BIND_LAZY );
if( !module ) {
vips_warn( "vips_init",
_( "unable to load \"%s\" -- %s" ),
path,
g_module_error() );
g_warning( _( "unable to load \"%s\" -- %s" ),
path, g_module_error() );
result = -1;
}
}
@ -343,11 +341,14 @@ vips_init( const char *argv0 )
bindtextdomain( GETTEXT_PACKAGE, name );
bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
/* Default various settings from env.
/* Deprecated, this is just for compat.
*/
if( g_getenv( "VIPS_INFO" ) ||
g_getenv( "IM_INFO" ) )
vips_info_set( TRUE );
/* Default various settings from env.
*/
if( g_getenv( "VIPS_TRACE" ) )
vips_cache_set_trace( TRUE );
@ -391,7 +392,7 @@ vips_init( const char *argv0 )
*/
if( im_load_plugins( "%s/vips-%d.%d",
libdir, VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION ) ) {
vips_warn( "vips_init", "%s", vips_error_buffer() );
g_warning( "%s", vips_error_buffer() );
vips_error_clear();
}
@ -399,7 +400,7 @@ vips_init( const char *argv0 )
* :-( kept for back compat convenience.
*/
if( im_load_plugins( "%s", libdir ) ) {
vips_warn( "vips_init", "%s", vips_error_buffer() );
g_warning( "%s", vips_error_buffer() );
vips_error_clear();
}
@ -578,12 +579,12 @@ vips__ngettext( const char *msgid, const char *plural, unsigned long int n )
}
static gboolean
vips_lib_version_cb( const gchar *option_name, const gchar *value,
vips_lib_info_cb( const gchar *option_name, const gchar *value,
gpointer data, GError **error )
{
printf( "libvips %s\n", VIPS_VERSION_STRING );
vips_shutdown();
exit( 0 );
vips_info_set( TRUE );
return( TRUE );
}
static gboolean
@ -604,9 +605,18 @@ vips_set_fatal_cb( const gchar *option_name, const gchar *value,
return( TRUE );
}
static gboolean
vips_lib_version_cb( const gchar *option_name, const gchar *value,
gpointer data, GError **error )
{
printf( "libvips %s\n", VIPS_VERSION_STRING );
vips_shutdown();
exit( 0 );
}
static GOptionEntry option_entries[] = {
{ "vips-info", 0, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_NONE, &vips__info,
{ "vips-info", 0, G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
G_OPTION_ARG_CALLBACK, (gpointer) &vips_lib_info_cb,
N_( "show informative messages" ), NULL },
{ "vips-fatal", 0, G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
G_OPTION_ARG_CALLBACK, (gpointer) &vips_set_fatal_cb,

View File

@ -177,7 +177,7 @@ vips__mmap( int fd, int writeable, size_t length, gint64 offset )
if( baseaddr == MAP_FAILED ) {
vips_error_system( errno, "vips_mapfile",
"%s", _( "unable to mmap" ) );
vips_warn( "vips_mapfile", _( "map failed (%s), "
g_warning( _( "map failed (%s), "
"running very low on system resources, "
"expect a crash soon" ), strerror( errno ) );
return( NULL );

View File

@ -248,11 +248,9 @@ vips_tracked_free( void *s )
g_mutex_lock( vips_tracked_mutex );
if( vips_tracked_allocs <= 0 )
vips_warn( "vips_tracked",
"%s", _( "vips_free: too many frees" ) );
g_warning( "%s", _( "vips_free: too many frees" ) );
if( vips_tracked_mem < size )
vips_warn( "vips_tracked",
"%s", _( "vips_free: too much free" ) );
g_warning( "%s", _( "vips_free: too much free" ) );
vips_tracked_mem -= size;
vips_tracked_allocs -= 1;
@ -310,8 +308,7 @@ vips_tracked_malloc( size_t size )
vips_error( "vips_tracked",
_( "out of memory --- size == %dMB" ),
(int) (size / (1024.0 * 1024.0)) );
vips_warn( "vips_tracked",
_( "out of memory --- size == %dMB" ),
g_warning( _( "out of memory --- size == %dMB" ),
(int) (size / (1024.0 * 1024.0)) );
return( NULL );

View File

@ -221,12 +221,8 @@ vips_operation_finalize( GObject *gobject )
VIPS_DEBUG_MSG( "vips_operation_finalize: %p\n", gobject );
if( operation->pixels ) {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gobject );
vips_info( class->nickname,
_( "%d pixels calculated" ), operation->pixels );
}
if( operation->pixels )
g_info( _( "%d pixels calculated" ), operation->pixels );
G_OBJECT_CLASS( vips_operation_parent_class )->finalize( gobject );
}

View File

@ -269,8 +269,7 @@ vips__region_stop( VipsRegion *region )
* can really do with it, sadly.
*/
if( result )
vips_warn( "VipsRegion",
"stop callback failed for image %s",
g_warning( "stop callback failed for image %s",
image->filename );
region->seq = NULL;

View File

@ -231,8 +231,7 @@ vips_system_build( VipsObject *object )
if( std_error ) {
vips__chomp( std_error );
if( strcmp( std_error, "" ) != 0 )
vips_warn( class->nickname,
_( "stderr output: %s" ), std_error );
g_warning( _( "stderr output: %s" ), std_error );
}
if( std_output ) {
vips__chomp( std_output );

View File

@ -407,8 +407,7 @@ vips_concurrency_get( void )
if( nthr < 1 || nthr > MAX_THREADS ) {
nthr = VIPS_CLIP( 1, nthr, MAX_THREADS );
vips_warn( "vips_concurrency_get",
_( "threads clipped to %d" ), nthr );
g_warning( _( "threads clipped to %d" ), nthr );
}
/* Save for next time around.

View File

@ -73,7 +73,7 @@ vips_vector_error( VipsVector *vector )
{
#ifdef HAVE_ORC_PROGRAM_GET_ERROR
if( vector->program )
vips_warn( "VipsVector", "orc error: %s",
g_warning( "orc error: %s",
orc_program_get_error( vector->program ) );
#endif /*HAVE_ORC_PROGRAM_GET_ERROR*/
}

View File

@ -915,8 +915,7 @@ vips_image_open_input( VipsImage *image )
return( -1 );
image->file_length = rsize;
if( psize > rsize )
vips_warn( "VipsImage",
_( "unable to read data for \"%s\", %s" ),
g_warning( _( "unable to read data for \"%s\", %s" ),
image->filename, _( "file has been truncated" ) );
/* Set demand style. This suits a disc file we read sequentially.
@ -928,8 +927,7 @@ vips_image_open_input( VipsImage *image )
* harmless.
*/
if( readhist( image ) ) {
vips_warn( "VipsImage", _( "error reading XML: %s" ),
vips_error_buffer() );
g_warning( _( "error reading XML: %s" ), vips_error_buffer() );
vips_error_clear();
}

View File

@ -465,7 +465,7 @@ vips_reduceh_build( VipsObject *object )
*/
reduceh->n_point =
vips_reduce_get_points( reduceh->kernel, reduceh->hshrink );
vips_info( object_class->nickname, "%d point mask", reduceh->n_point );
g_info( "%d point mask", reduceh->n_point );
if( reduceh->n_point > MAX_POINT ) {
vips_error( object_class->nickname,
"%s", _( "reduce factor too large" ) );

View File

@ -779,7 +779,7 @@ vips_reducev_raw( VipsReducev *reducev, VipsImage *in )
if( in->BandFmt == VIPS_FORMAT_UCHAR &&
vips_vector_isenabled() &&
!vips_reducev_compile( reducev ) ) {
vips_info( object_class->nickname, "using vector path" );
g_info( "using vector path" );
generate = vips_reducev_vector_gen;
}
@ -848,7 +848,7 @@ vips_reducev_build( VipsObject *object )
"%s", _( "reduce factor too large" ) );
return( -1 );
}
vips_info( object_class->nickname, "%d point mask", reducev->n_point );
g_info( "%d point mask", reducev->n_point );
/* Unpack for processing.
*/

View File

@ -155,7 +155,6 @@ vips_resize_interpolate( VipsKernel kernel )
static int
vips_resize_build( VipsObject *object )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsResample *resample = VIPS_RESAMPLE( object );
VipsResize *resize = (VipsResize *) object;
@ -186,7 +185,7 @@ vips_resize_build( VipsObject *object )
int_vshrink = vips_resize_int_shrink( resize, vscale );
if( int_vshrink > 1 ) {
vips_info( class->nickname, "shrinkv by %d", int_vshrink );
g_info( "shrinkv by %d", int_vshrink );
if( vips_shrinkv( in, &t[0], int_vshrink, NULL ) )
return( -1 );
in = t[0];
@ -195,7 +194,7 @@ vips_resize_build( VipsObject *object )
}
if( int_hshrink > 1 ) {
vips_info( class->nickname, "shrinkh by %d", int_hshrink );
g_info( "shrinkh by %d", int_hshrink );
if( vips_shrinkh( in, &t[1], int_hshrink, NULL ) )
return( -1 );
in = t[1];
@ -251,8 +250,7 @@ vips_resize_build( VipsObject *object )
/* Any residual downsizing.
*/
if( vscale < 1.0 ) {
vips_info( class->nickname, "residual reducev by %g",
vscale );
g_info( "residual reducev by %g", vscale );
if( vips_reducev( in, &t[2], 1.0 / vscale,
"kernel", resize->kernel,
"centre", resize->centre,
@ -262,7 +260,7 @@ vips_resize_build( VipsObject *object )
}
if( hscale < 1.0 ) {
vips_info( class->nickname, "residual reduceh by %g",
g_info( "residual reduceh by %g",
hscale );
if( vips_reduceh( in, &t[3], 1.0 / hscale,
"kernel", resize->kernel,
@ -285,8 +283,7 @@ vips_resize_build( VipsObject *object )
if( hscale > 1.0 &&
vscale > 1.0 ) {
vips_info( class->nickname,
"residual scale %g x %g", hscale, vscale );
g_info( "residual scale %g x %g", hscale, vscale );
if( vips_affine( in, &t[4],
hscale, 0.0, 0.0, vscale,
"interpolate", interpolate,
@ -295,8 +292,7 @@ vips_resize_build( VipsObject *object )
in = t[4];
}
else if( hscale > 1.0 ) {
vips_info( class->nickname,
"residual scale %g", hscale );
g_info( "residual scale %g", hscale );
if( vips_affine( in, &t[4], hscale, 0.0, 0.0, 1.0,
"interpolate", interpolate,
NULL ) )
@ -304,8 +300,7 @@ vips_resize_build( VipsObject *object )
in = t[4];
}
else {
vips_info( class->nickname,
"residual scale %g", vscale );
g_info( "residual scale %g", vscale );
if( vips_affine( in, &t[4], 1.0, 0.0, 0.0, vscale,
"interpolate", interpolate,
NULL ) )

View File

@ -195,9 +195,8 @@ vips_thumbnail_open( VipsThumbnail *thumbnail )
if( class->get_info( thumbnail ) )
return( NULL );
vips_info( "thumbnail", "selected loader is %s",
thumbnail->loader );
vips_info( "thumbnail", "input size is %d x %d",
g_info( "selected loader is %s", thumbnail->loader );
g_info( "input size is %d x %d",
thumbnail->input_width, thumbnail->input_height );
shrink = 1;
@ -206,21 +205,18 @@ vips_thumbnail_open( VipsThumbnail *thumbnail )
if( vips_isprefix( "VipsForeignLoadJpeg", thumbnail->loader ) ) {
shrink = vips_thumbnail_find_jpegshrink( thumbnail,
thumbnail->input_width, thumbnail->input_height );
vips_info( "thumbnail",
"loading jpeg with factor %d pre-shrink", shrink );
g_info( "loading jpeg with factor %d pre-shrink", shrink );
}
else if( vips_isprefix( "VipsForeignLoadPdf", thumbnail->loader ) ||
vips_isprefix( "VipsForeignLoadSvg", thumbnail->loader ) ) {
scale = 1.0 / vips_thumbnail_calculate_shrink( thumbnail,
thumbnail->input_width, thumbnail->input_height );
vips_info( "thumbnail",
"loading PDF/SVG with factor %g pre-scale", scale );
g_info( "loading PDF/SVG with factor %g pre-scale", scale );
}
else if( vips_isprefix( "VipsForeignLoadWebp", thumbnail->loader ) ) {
shrink = vips_thumbnail_calculate_shrink( thumbnail,
thumbnail->input_width, thumbnail->input_height );
vips_info( "thumbnail",
"loading webp with factor %d pre-shrink", shrink );
g_info( "loading webp with factor %d pre-shrink", shrink );
}
if( !(im = class->open( thumbnail, shrink, scale )) )
@ -269,7 +265,7 @@ vips_thumbnail_build( VipsObject *object )
/* RAD needs special unpacking.
*/
if( in->Coding == VIPS_CODING_RAD ) {
vips_info( "thumbnail", "unpacking Rad to float" );
g_info( "unpacking Rad to float" );
/* rad is scrgb.
*/
@ -296,11 +292,9 @@ vips_thumbnail_build( VipsObject *object )
(vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ||
thumbnail->import_profile) ) {
if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) )
vips_info( "thumbnail",
"importing with embedded profile" );
g_info( "importing with embedded profile" );
else
vips_info( "thumbnail",
"importing with profile %s",
g_info( "importing with profile %s",
thumbnail->import_profile );
if( vips_icc_import( in, &t[1],
@ -317,7 +311,7 @@ vips_thumbnail_build( VipsObject *object )
/* To the processing colourspace. This will unpack LABQ as well.
*/
vips_info( "thumbnail", "converting to processing space %s",
g_info( "converting to processing space %s",
vips_enum_nick( VIPS_TYPE_INTERPRETATION, interpretation ) );
if( vips_colourspace( in, &t[2], interpretation, NULL ) )
return( -1 );
@ -328,7 +322,7 @@ vips_thumbnail_build( VipsObject *object )
*/
have_premultiplied = FALSE;
if( vips_image_hasalpha( in ) ) {
vips_info( "thumbnail", "premultiplying alpha" );
g_info( "premultiplying alpha" );
if( vips_premultiply( in, &t[3], NULL ) )
return( -1 );
have_premultiplied = TRUE;
@ -353,7 +347,7 @@ vips_thumbnail_build( VipsObject *object )
in = t[4];
if( have_premultiplied ) {
vips_info( "thumbnail", "unpremultiplying alpha" );
g_info( "unpremultiplying alpha" );
if( vips_unpremultiply( in, &t[5], NULL ) ||
vips_cast( t[5], &t[6], unpremultiplied_format, NULL ) )
return( -1 );
@ -369,8 +363,7 @@ vips_thumbnail_build( VipsObject *object )
if( have_imported ) {
if( thumbnail->export_profile ||
vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) {
vips_info( "thumbnail",
"exporting to device space with a profile" );
g_info( "exporting to device space with a profile" );
if( vips_icc_export( in, &t[7],
"output_profile", thumbnail->export_profile,
NULL ) )
@ -378,7 +371,7 @@ vips_thumbnail_build( VipsObject *object )
in = t[7];
}
else {
vips_info( "thumbnail", "converting to sRGB" );
g_info( "converting to sRGB" );
if( vips_colourspace( in, &t[7],
VIPS_INTERPRETATION_sRGB, NULL ) )
return( -1 );
@ -390,23 +383,20 @@ vips_thumbnail_build( VipsObject *object )
thumbnail->import_profile) ) {
VipsImage *out;
vips_info( "thumbnail",
"exporting with profile %s", thumbnail->export_profile );
g_info( "exporting with profile %s", thumbnail->export_profile );
/* We first try with the embedded profile, if any, then if
* that fails try again with the supplied fallback profile.
*/
out = NULL;
if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) {
vips_info( "thumbnail",
"importing with embedded profile" );
g_info( "importing with embedded profile" );
if( vips_icc_transform( in, &t[7],
thumbnail->export_profile,
"embedded", TRUE,
NULL ) ) {
vips_warn( "thumbnail",
_( "unable to import with "
g_warning( _( "unable to import with "
"embedded profile: %s" ),
vips_error_buffer() );
@ -418,8 +408,7 @@ vips_thumbnail_build( VipsObject *object )
if( !out &&
thumbnail->import_profile ) {
vips_info( "thumbnail",
"importing with fallback profile" );
g_info( "importing with fallback profile" );
if( vips_icc_transform( in, &t[7],
thumbnail->export_profile,
@ -442,7 +431,7 @@ vips_thumbnail_build( VipsObject *object )
int left = (in->Xsize - thumbnail->width) / 2;
int top = (in->Ysize - thumbnail->height) / 2;
vips_info( "thumbnail", "cropping to %dx%d",
g_info( "cropping to %dx%d",
thumbnail->width, thumbnail->height );
if( vips_extract_area( in, &t[8], left, top,
thumbnail->width, thumbnail->height, NULL ) )
@ -454,7 +443,7 @@ vips_thumbnail_build( VipsObject *object )
thumbnail->angle != VIPS_ANGLE_D0 ) {
VipsAngle angle = vips_autorot_get_angle( in );
vips_info( "thumbnail", "rotating by %s",
g_info( "rotating by %s",
vips_enum_nick( VIPS_TYPE_ANGLE, angle ) );
/* Need to copy to memory, we have to stay seq.
@ -573,7 +562,7 @@ vips_thumbnail_file_get_info( VipsThumbnail *thumbnail )
VipsImage *image;
vips_info( "thumbnail", "thumbnailing %s", file->filename );
g_info( "thumbnailing %s", file->filename );
if( !(thumbnail->loader = vips_foreign_find_load( file->filename )) ||
!(image = vips_image_new_from_file( file->filename, NULL )) )
@ -726,8 +715,7 @@ vips_thumbnail_buffer_get_info( VipsThumbnail *thumbnail )
VipsImage *image;
vips_info( "thumbnail", "thumbnailing %zd bytes of data",
buffer->buf->length );
g_info( "thumbnailing %zd bytes of data", buffer->buf->length );
if( !(thumbnail->loader = vips_foreign_find_load_buffer(
buffer->buf->data, buffer->buf->length )) ||

View File

@ -213,8 +213,7 @@ thumbnail_write( VipsObject *process, VipsImage *im, const char *filename )
g_free( dir );
}
vips_info( "vipsthumbnail",
"thumbnailing %s as %s", filename, output_name );
g_info( "thumbnailing %s as %s", filename, output_name );
g_free( file );
@ -308,7 +307,7 @@ main( int argc, char **argv )
if( rotate_image ) {
#ifndef HAVE_EXIF
vips_warn( "vipsthumbnail", "%s",
g_warning( "%s",
_( "auto-rotate disabled: "
"libvips built without exif support" ) );
#endif /*!HAVE_EXIF*/