Merge branch 'master' of github.com:jcupitt/libvips

This commit is contained in:
John Cupitt 2012-11-15 12:06:34 +00:00
commit 717266ad2b
13 changed files with 163 additions and 69 deletions

View File

@ -17,7 +17,15 @@
- dzsave --layout google has a @background option - dzsave --layout google has a @background option
- dzsave has a --depth option - dzsave has a --depth option
- update for new glib threading API - update for new glib threading API
- remove no threads option - remove no threads option, glib no longer support it
- better --help output for vips driver prog
- vipsthumbnail -o allows absolute file names
14/11/12 started 7.30.6
- capture tiff warnings earlier
14/11/12 started 7.30.5
- fix libtool version mess up (thanks Benjamin)
2/10/12 started 7.30.4 2/10/12 started 7.30.4
- remove options from format string in .dzi (thanks Martin) - remove options from format string in .dzi (thanks Martin)

View File

@ -40,7 +40,7 @@ Then for a debug build:
# Dependencies # Dependencies
libvips has to have gettext, glib-2.x and libxml-2.0. The build system needs libvips has to have gettext, glib-2.x and libxml-2.0. The build system needs
sh, pkg-config and gnu make. sh, pkg-config, swig, gtk-doc-tools, automake, gobject-introspection and gnu make.
# Optional dependencies # Optional dependencies

17
TODO
View File

@ -1,3 +1,20 @@
- have a web page with a list of the python member names
$ vips cpph all | grep join
VImage bandjoin( VImage bandjoin_in2 ) throw( VError );
static VImage
gbandjoin( std::vector<VImage> gbandjoin_in ) throw( VError );
VImage lrjoin( VImage lrjoin_in2 ) throw( VError );
VImage tbjoin( VImage tbjoin_in2 ) throw( VError );
could generate some docs too?
perhaps it should be part of vips.c
- check libtool version number, should be binary-compat with 7.30
- quadratic doesn't work for order 3 - quadratic doesn't work for order 3
start to get jaggies on lines --- the 3rd differential isn't being start to get jaggies on lines --- the 3rd differential isn't being

View File

@ -36,8 +36,7 @@ extern "C" {
extern const char *vips__foreign_tiff_suffs[]; extern const char *vips__foreign_tiff_suffs[];
void vips__thandler_error( const char *module, const char *fmt, va_list ap ); void vips__tiff_init( void );
void vips__thandler_warning( const char *module, const char *fmt, va_list ap );
int vips__tiff_write( VipsImage *in, const char *filename, int vips__tiff_write( VipsImage *in, const char *filename,
VipsForeignTiffCompression compression, int Q, VipsForeignTiffCompression compression, int Q,

View File

@ -229,13 +229,13 @@ typedef struct {
* more than one thread, but vips_error and vips_warn have mutexes in, so that's * more than one thread, but vips_error and vips_warn have mutexes in, so that's
* OK. * OK.
*/ */
void static void
vips__thandler_error( const char *module, const char *fmt, va_list ap ) vips__thandler_error( const char *module, const char *fmt, va_list ap )
{ {
vips_verror( module, fmt, ap ); vips_verror( module, fmt, ap );
} }
void static void
vips__thandler_warning( const char *module, const char *fmt, va_list ap ) vips__thandler_warning( const char *module, const char *fmt, va_list ap )
{ {
char buf[256]; char buf[256];
@ -244,6 +244,16 @@ vips__thandler_warning( const char *module, const char *fmt, va_list ap )
vips_warn( module, "%s", buf ); vips_warn( module, "%s", buf );
} }
/* Call this during startup. Other libraries may be using libtiff and we want
* to capture any messages they send as well.
*/
void
vips__tiff_init( void )
{
TIFFSetErrorHandler( vips__thandler_error );
TIFFSetWarningHandler( vips__thandler_warning );
}
/* Test for field exists. /* Test for field exists.
*/ */
static int static int
@ -1506,8 +1516,7 @@ istiffpyramid( const char *name )
{ {
TIFF *tif; TIFF *tif;
TIFFSetErrorHandler( vips__thandler_error ); vips__tiff_init();
TIFFSetWarningHandler( vips__thandler_warning );
if( (tif = get_directory( name, 2 )) ) { if( (tif = get_directory( name, 2 )) ) {
// We can see page 2 ... assume it is. // We can see page 2 ... assume it is.
@ -1529,8 +1538,7 @@ vips__tiff_read( const char *filename, VipsImage *out, int page )
printf( "tiff2vips: libtiff starting for %s\n", filename ); printf( "tiff2vips: libtiff starting for %s\n", filename );
#endif /*DEBUG*/ #endif /*DEBUG*/
TIFFSetErrorHandler( vips__thandler_error ); vips__tiff_init();
TIFFSetWarningHandler( vips__thandler_warning );
if( !(rtiff = readtiff_new( filename, out, page )) ) if( !(rtiff = readtiff_new( filename, out, page )) )
return( -1 ); return( -1 );
@ -1558,8 +1566,7 @@ vips__tiff_read_header( const char *filename, VipsImage *out, int page )
{ {
ReadTiff *rtiff; ReadTiff *rtiff;
TIFFSetErrorHandler( vips__thandler_error ); vips__tiff_init();
TIFFSetWarningHandler( vips__thandler_warning );
if( !(rtiff = readtiff_new( filename, out, page )) ) if( !(rtiff = readtiff_new( filename, out, page )) )
return( -1 ); return( -1 );
@ -1583,10 +1590,7 @@ vips__istifftiled( const char *filename )
TIFF *tif; TIFF *tif;
gboolean tiled; gboolean tiled;
/* Override the default TIFF error handler. vips__tiff_init();
*/
TIFFSetErrorHandler( vips__thandler_error );
TIFFSetWarningHandler( vips__thandler_warning );
if( !(tif = TIFFOpen( filename, "rm" )) ) { if( !(tif = TIFFOpen( filename, "rm" )) ) {
vips_error_clear(); vips_error_clear();

View File

@ -123,6 +123,13 @@ vips_foreign_load_tiff_class_init( VipsForeignLoadTiffClass *class )
VipsForeignClass *foreign_class = (VipsForeignClass *) class; VipsForeignClass *foreign_class = (VipsForeignClass *) class;
VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class; VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class;
/* Other libraries may be using libtiff, we want to capture tiff
* warning and error as soon as we can.
*
* This class init will be triggered during startup.
*/
vips__tiff_init();
gobject_class->set_property = vips_object_set_property; gobject_class->set_property = vips_object_set_property;
gobject_class->get_property = vips_object_get_property; gobject_class->get_property = vips_object_get_property;

View File

@ -1474,7 +1474,6 @@ gather_pyramid( TiffWrite *tw )
return( 0 ); return( 0 );
} }
int int
vips__tiff_write( VipsImage *in, const char *filename, vips__tiff_write( VipsImage *in, const char *filename,
VipsForeignTiffCompression compression, int Q, VipsForeignTiffCompression compression, int Q,
@ -1493,10 +1492,7 @@ vips__tiff_write( VipsImage *in, const char *filename,
printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() ); printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
#endif /*DEBUG*/ #endif /*DEBUG*/
/* Override the default TIFF error handler. vips__tiff_init();
*/
TIFFSetErrorHandler( vips__thandler_error );
TIFFSetWarningHandler( vips__thandler_warning );
/* Check input image. /* Check input image.
*/ */

View File

@ -10,10 +10,14 @@ msgstr ""
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=glib&keywords=I18N+L10N&component=general\n" "product=glib&keywords=I18N+L10N&component=general\n"
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
"POT-Creation-Date: 2012-09-08 14:01+0100\n" "POT-Creation-Date: 2012-09-08 14:01+0100\n"
======= =======
"POT-Creation-Date: 2012-10-01 14:17+0100\n" "POT-Creation-Date: 2012-10-01 14:17+0100\n"
>>>>>>> origin/master >>>>>>> origin/master
=======
"POT-Creation-Date: 2012-11-14 09:36+0000\n"
>>>>>>> origin/7.30
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -400,10 +404,14 @@ msgstr ""
#: ../libvips/conversion/bandjoin.c:171 ../libvips/conversion/copy.c:321 #: ../libvips/conversion/bandjoin.c:171 ../libvips/conversion/copy.c:321
#: ../libvips/conversion/rot.c:359 ../libvips/conversion/replicate.c:196 #: ../libvips/conversion/rot.c:359 ../libvips/conversion/replicate.c:196
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
#: ../libvips/conversion/tilecache.c:355 ../libvips/conversion/embed.c:523 #: ../libvips/conversion/tilecache.c:355 ../libvips/conversion/embed.c:523
======= =======
#: ../libvips/conversion/tilecache.c:357 ../libvips/conversion/embed.c:523 #: ../libvips/conversion/tilecache.c:357 ../libvips/conversion/embed.c:523
>>>>>>> origin/master >>>>>>> origin/master
=======
#: ../libvips/conversion/tilecache.c:359 ../libvips/conversion/embed.c:523
>>>>>>> origin/7.30
#: ../libvips/conversion/cache.c:100 ../libvips/conversion/recomb.c:203 #: ../libvips/conversion/cache.c:100 ../libvips/conversion/recomb.c:203
#: ../libvips/conversion/sequential.c:273 ../libvips/foreign/foreign.c:1413 #: ../libvips/conversion/sequential.c:273 ../libvips/foreign/foreign.c:1413
#: ../libvips/resample/resample.c:89 #: ../libvips/resample/resample.c:89
@ -576,10 +584,14 @@ msgstr ""
#: ../libvips/conversion/extract.c:198 ../libvips/conversion/extract.c:357 #: ../libvips/conversion/extract.c:198 ../libvips/conversion/extract.c:357
#: ../libvips/conversion/copy.c:322 ../libvips/conversion/rot.c:360 #: ../libvips/conversion/copy.c:322 ../libvips/conversion/rot.c:360
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
#: ../libvips/conversion/replicate.c:197 ../libvips/conversion/tilecache.c:356 #: ../libvips/conversion/replicate.c:197 ../libvips/conversion/tilecache.c:356
======= =======
#: ../libvips/conversion/replicate.c:197 ../libvips/conversion/tilecache.c:358 #: ../libvips/conversion/replicate.c:197 ../libvips/conversion/tilecache.c:358
>>>>>>> origin/master >>>>>>> origin/master
=======
#: ../libvips/conversion/replicate.c:197 ../libvips/conversion/tilecache.c:360
>>>>>>> origin/7.30
#: ../libvips/conversion/embed.c:524 ../libvips/conversion/cache.c:101 #: ../libvips/conversion/embed.c:524 ../libvips/conversion/cache.c:101
#: ../libvips/conversion/sequential.c:274 #: ../libvips/conversion/sequential.c:274
msgid "Input image" msgid "Input image"
@ -1116,6 +1128,7 @@ msgstr ""
msgid "Top edge of sub in main" msgid "Top edge of sub in main"
msgstr "" msgstr ""
<<<<<<< HEAD
<<<<<<< HEAD <<<<<<< HEAD
#: ../libvips/conversion/tilecache.c:351 ../libvips/conversion/cache.c:96 #: ../libvips/conversion/tilecache.c:351 ../libvips/conversion/cache.c:96
msgid "cache an image" msgid "cache an image"
@ -1166,53 +1179,60 @@ msgstr ""
#: ../libvips/conversion/tilecache.c:699 #: ../libvips/conversion/tilecache.c:699
======= =======
#: ../libvips/conversion/tilecache.c:353 ../libvips/conversion/cache.c:96 #: ../libvips/conversion/tilecache.c:353 ../libvips/conversion/cache.c:96
=======
#: ../libvips/conversion/tilecache.c:355 ../libvips/conversion/cache.c:96
>>>>>>> origin/7.30
msgid "cache an image" msgid "cache an image"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:363 ../libvips/conversion/cache.c:113 #: ../libvips/conversion/tilecache.c:365 ../libvips/conversion/cache.c:113
#: ../libvips/conversion/sequential.c:286 ../libvips/foreign/tiffsave.c:222 #: ../libvips/conversion/sequential.c:286 ../libvips/foreign/tiffsave.c:222
#: ../libvips/foreign/dzsave.c:920 #: ../libvips/foreign/dzsave.c:927
msgid "Tile height" msgid "Tile height"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:364 ../libvips/conversion/cache.c:114 #: ../libvips/conversion/tilecache.c:366 ../libvips/conversion/cache.c:114
#: ../libvips/conversion/sequential.c:287 ../libvips/foreign/tiffsave.c:223 #: ../libvips/conversion/sequential.c:287 ../libvips/foreign/tiffsave.c:223
#: ../libvips/foreign/dzsave.c:921 #: ../libvips/foreign/dzsave.c:928
msgid "Tile height in pixels" msgid "Tile height in pixels"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:370 #: ../libvips/conversion/tilecache.c:372
msgid "Strategy" msgid "Strategy"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:371 #: ../libvips/conversion/tilecache.c:373
msgid "Expected access pattern" msgid "Expected access pattern"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:540 #: ../libvips/conversion/tilecache.c:542
msgid "cache an image as a set of tiles" msgid "cache an image as a set of tiles"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:544 ../libvips/conversion/cache.c:106 #: ../libvips/conversion/tilecache.c:546 ../libvips/conversion/cache.c:106
#: ../libvips/foreign/tiffsave.c:215 ../libvips/foreign/dzsave.c:913 #: ../libvips/foreign/tiffsave.c:215 ../libvips/foreign/dzsave.c:920
msgid "Tile width" msgid "Tile width"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:545 ../libvips/conversion/cache.c:107 #: ../libvips/conversion/tilecache.c:547 ../libvips/conversion/cache.c:107
#: ../libvips/foreign/tiffsave.c:216 ../libvips/foreign/dzsave.c:914 #: ../libvips/foreign/tiffsave.c:216 ../libvips/foreign/dzsave.c:921
msgid "Tile width in pixels" msgid "Tile width in pixels"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:551 ../libvips/conversion/cache.c:120 #: ../libvips/conversion/tilecache.c:553 ../libvips/conversion/cache.c:120
msgid "Max tiles" msgid "Max tiles"
msgstr "" msgstr ""
#: ../libvips/conversion/tilecache.c:552 ../libvips/conversion/cache.c:121 #: ../libvips/conversion/tilecache.c:554 ../libvips/conversion/cache.c:121
msgid "Maximum number of tiles to cache" msgid "Maximum number of tiles to cache"
msgstr "" msgstr ""
<<<<<<< HEAD
#: ../libvips/conversion/tilecache.c:706 #: ../libvips/conversion/tilecache.c:706
>>>>>>> origin/master >>>>>>> origin/master
=======
#: ../libvips/conversion/tilecache.c:709
>>>>>>> origin/7.30
msgid "cache an image as a set of lines" msgid "cache an image as a set of lines"
msgstr "" msgstr ""
@ -1589,48 +1609,48 @@ msgstr ""
msgid "Write a bigtiff image" msgid "Write a bigtiff image"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:243 #: ../libvips/foreign/dzsave.c:245
#, c-format #, c-format
msgid "Directory \"%s_files\" exists" msgid "Directory \"%s_files\" exists"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:812 #: ../libvips/foreign/dzsave.c:819
msgid "overlap must be less than tile width and height" msgid "overlap must be less than tile width and height"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:865 #: ../libvips/foreign/dzsave.c:872
msgid "save image to deep zoom format" msgid "save image to deep zoom format"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:875 ../libvips/foreign/dzsave.c:906 #: ../libvips/foreign/dzsave.c:882 ../libvips/foreign/dzsave.c:913
msgid "Base name" msgid "Base name"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:876 ../libvips/foreign/dzsave.c:907 #: ../libvips/foreign/dzsave.c:883 ../libvips/foreign/dzsave.c:914
msgid "Base name to save to" msgid "Base name to save to"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:882 #: ../libvips/foreign/dzsave.c:889
msgid "suffix" msgid "suffix"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:883 #: ../libvips/foreign/dzsave.c:890
msgid "Filename suffix for tiles" msgid "Filename suffix for tiles"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:889 #: ../libvips/foreign/dzsave.c:896
msgid "Overlap" msgid "Overlap"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:890 #: ../libvips/foreign/dzsave.c:897
msgid "Tile overlap in pixels" msgid "Tile overlap in pixels"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:896 #: ../libvips/foreign/dzsave.c:903
msgid "Tile size" msgid "Tile size"
msgstr "" msgstr ""
#: ../libvips/foreign/dzsave.c:897 #: ../libvips/foreign/dzsave.c:904
msgid "Tile size in pixels" msgid "Tile size in pixels"
msgstr "" msgstr ""

View File

@ -12,14 +12,9 @@
VIPSHOME=${VIPSHOME-@prefix@} VIPSHOME=${VIPSHOME-@prefix@}
name=`basename $0` name=`basename $0`
left=$1
top=$2
width=$3
height=$4
shift 4
# check args # check args
if [ $# -lt 1 ]; then if [ $# -lt 5 ]; then
echo "usage: $name left top width height image1 image2 ..." echo "usage: $name left top width height image1 image2 ..."
echo echo
echo "$name writes a new set of images called crop_image1, " echo "$name writes a new set of images called crop_image1, "
@ -28,6 +23,12 @@ if [ $# -lt 1 ]; then
exit 1 exit 1
fi fi
left=$1
top=$2
width=$3
height=$4
shift 4
# convert each argument # convert each argument
for i in $*; do for i in $*; do
dir=`dirname $i` dir=`dirname $i`

View File

@ -12,11 +12,9 @@
VIPSHOME=${VIPSHOME-@prefix@} VIPSHOME=${VIPSHOME-@prefix@}
name=`basename $0` name=`basename $0`
type=$1
shift
# check args # check args
if [ $# -lt 1 ]; then if [ $# -lt 2 ]; then
echo "usage: $name <new image type> image1 image2 ..." echo "usage: $name <new image type> image1 image2 ..."
echo echo
echo "$name uses VIPS to convert a group of image files of" echo "$name uses VIPS to convert a group of image files of"
@ -27,6 +25,9 @@ if [ $# -lt 1 ]; then
exit 1 exit 1
fi fi
type=$1
shift
# convert each argument # convert each argument
for i in $*; do for i in $*; do
# drop the suffix on the filename # drop the suffix on the filename

View File

@ -14,11 +14,9 @@ VIPSHOME=${VIPSHOME-@prefix@}
# get name we were run as # get name we were run as
name=`basename $0` name=`basename $0`
rec=$1
shift
# check args # check args
if [ $# -lt 1 ]; then if [ $# -lt 2 ]; then
echo "usage: $name matrix image1 image2 ..." echo "usage: $name matrix image1 image2 ..."
echo "writes rsc_image1, rsc_image2, ..." echo "writes rsc_image1, rsc_image2, ..."
echo echo
@ -28,6 +26,9 @@ if [ $# -lt 1 ]; then
exit 1 exit 1
fi fi
rec=$1
shift
# transform each argument # transform each argument
for i in $*; do for i in $*; do
echo "Transforming $i to rsc_$i ..." echo "Transforming $i to rsc_$i ..."

View File

@ -905,6 +905,20 @@ print_cppdefs( int argc, char **argv )
return( 0 ); return( 0 );
} }
static void action_list( VipsBuf *buf );
static int
print_help( int argc, char **argv )
{
char txt[1024];
VipsBuf buf = VIPS_BUF_STATIC( txt );
action_list( &buf );
printf( "%s", vips_buf_all( &buf ) );
return( 0 );
}
/* All our built-in actions. /* All our built-in actions.
*/ */
@ -930,11 +944,28 @@ static ActionEntry actions[] = {
&empty_options[0], print_cppdefs }, &empty_options[0], print_cppdefs },
{ "links", N_( "generate links for vips/bin" ), { "links", N_( "generate links for vips/bin" ),
&empty_options[0], print_links }, &empty_options[0], print_links },
{ "help", N_( "list possible actions" ),
&empty_options[0], print_help },
}; };
static void
action_list( VipsBuf *buf )
{
int i;
vips_buf_appends( buf, _( "possible actions:\n" ) );
for( i = 0; i < VIPS_NUMBER( actions ); i++ )
vips_buf_appendf( buf, "%7s - %s\n",
actions[i].name, _( actions[i].description ) );
vips_buf_appendf( buf, "%7s - %s\n",
"OP", _( "execute vips operation OP" ) );
}
static void static void
parse_options( GOptionContext *context, int *argc, char **argv ) parse_options( GOptionContext *context, int *argc, char **argv )
{ {
char txt[1024];
VipsBuf buf = VIPS_BUF_STATIC( txt );
GError *error = NULL; GError *error = NULL;
int i, j; int i, j;
@ -944,6 +975,9 @@ parse_options( GOptionContext *context, int *argc, char **argv )
printf( "%d) %s\n", i, argv[i] ); printf( "%d) %s\n", i, argv[i] );
#endif /*DEBUG*/ #endif /*DEBUG*/
action_list( &buf );
g_option_context_set_summary( context, vips_buf_all( &buf ) );
if( !g_option_context_parse( context, argc, &argv, &error ) ) { if( !g_option_context_parse( context, argc, &argv, &error ) ) {
if( error ) { if( error ) {
fprintf( stderr, "%s\n", error->message ); fprintf( stderr, "%s\n", error->message );
@ -1128,13 +1162,7 @@ main( int argc, char **argv )
if( action && if( action &&
!handled ) { !handled ) {
printf( "%s", _( "possible actions:\n" ) ); print_help( argc, argv );
for( i = 0; i < VIPS_NUMBER( actions ); i++ )
printf( "%10s - %s\n",
actions[i].name, _( actions[i].description ) );
printf( "%10s - %s\n",
"<operation>", _( "execute named vips operation" ) );
error_exit( _( "unknown action \"%s\"" ), action ); error_exit( _( "unknown action \"%s\"" ), action );
} }

View File

@ -31,6 +31,8 @@
* - remove "--nodelete" option, have a --delete option instead, off by * - remove "--nodelete" option, have a --delete option instead, off by
* default * default
* - much more gentle extra sharpening * - much more gentle extra sharpening
* 13/11/12
* - allow absolute paths in -o (thanks fuho)
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -306,25 +308,35 @@ thumbnail3( IMAGE *in, IMAGE *out )
static char * static char *
make_thumbnail_name( const char *filename ) make_thumbnail_name( const char *filename )
{ {
char *dir;
char *file; char *file;
char *p; char *p;
char buf[FILENAME_MAX]; char buf[FILENAME_MAX];
char *result; char *result;
dir = g_path_get_dirname( filename );
file = g_path_get_basename( filename ); file = g_path_get_basename( filename );
/* Remove the suffix from the file portion.
*/
if( (p = strrchr( file, '.' )) ) if( (p = strrchr( file, '.' )) )
*p = '\0'; *p = '\0';
/* output_format can be an absolute path, in which case we discard the
* path from the incoming file.
*/
im_snprintf( buf, FILENAME_MAX, output_format, file ); im_snprintf( buf, FILENAME_MAX, output_format, file );
result = g_build_filename( dir, buf, NULL ); if( g_path_is_absolute( output_format ) )
result = g_strdup( buf );
else {
char *dir;
dir = g_path_get_dirname( filename );
result = g_build_filename( dir, buf, NULL );
g_free( dir );
}
if( verbose ) if( verbose )
printf( "thumbnailing %s as %s\n", filename, buf ); printf( "thumbnailing %s as %s\n", filename, result );
g_free( dir );
g_free( file ); g_free( file );
return( result ); return( result );