bump to 7.21, im_system_image works
This commit is contained in:
parent
2f0a6ab66b
commit
1861c82cf6
@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR(m4)
|
|||||||
# user-visible library versioning
|
# user-visible library versioning
|
||||||
IM_MAJOR_VERSION=7
|
IM_MAJOR_VERSION=7
|
||||||
IM_MINOR_VERSION=21
|
IM_MINOR_VERSION=21
|
||||||
IM_MICRO_VERSION=0
|
IM_MICRO_VERSION=1
|
||||||
IM_VERSION=$IM_MAJOR_VERSION.$IM_MINOR_VERSION.$IM_MICRO_VERSION
|
IM_VERSION=$IM_MAJOR_VERSION.$IM_MINOR_VERSION.$IM_MICRO_VERSION
|
||||||
IM_VERSION_STRING=$IM_VERSION-`date`
|
IM_VERSION_STRING=$IM_VERSION-`date`
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ PACKAGE=vips
|
|||||||
# interface changes not backwards compatible?: reset age to 0
|
# interface changes not backwards compatible?: reset age to 0
|
||||||
|
|
||||||
LIBRARY_CURRENT=28
|
LIBRARY_CURRENT=28
|
||||||
LIBRARY_REVISION=2
|
LIBRARY_REVISION=3
|
||||||
LIBRARY_AGE=13
|
LIBRARY_AGE=13
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
|
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
|
||||||
|
@ -63,11 +63,6 @@
|
|||||||
|
|
||||||
#define IM_MAX_STRSIZE (4096)
|
#define IM_MAX_STRSIZE (4096)
|
||||||
|
|
||||||
#ifdef OS_WIN32
|
|
||||||
#define popen(b,m) _popen(b,m)
|
|
||||||
#define pclose(f) _pclose(f)
|
|
||||||
#endif /*OS_WIN32*/
|
|
||||||
|
|
||||||
/* Run a command on an IMAGE ... copy to tmp (if necessary), run
|
/* Run a command on an IMAGE ... copy to tmp (if necessary), run
|
||||||
* command on it, unlink (if we copied), return stdout from command.
|
* command on it, unlink (if we copied), return stdout from command.
|
||||||
*/
|
*/
|
||||||
|
@ -53,18 +53,12 @@
|
|||||||
|
|
||||||
#define IM_MAX_STRSIZE (4096)
|
#define IM_MAX_STRSIZE (4096)
|
||||||
|
|
||||||
#ifdef OS_WIN32
|
|
||||||
#define popen(b,m) _popen(b,m)
|
|
||||||
#define pclose(f) _pclose(f)
|
|
||||||
#endif /*OS_WIN32*/
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
system_image( IMAGE *im,
|
system_image( IMAGE *im,
|
||||||
IMAGE *in_image, IMAGE *out_image, const char *cmd_format,
|
IMAGE *in_image, char *out_name, const char *cmd_format,
|
||||||
char **log )
|
char **log )
|
||||||
{
|
{
|
||||||
const char *in_name = in_image->filename;
|
const char *in_name = in_image->filename;
|
||||||
const char *out_name = out_image->filename;
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char line[IM_MAX_STRSIZE];
|
char line[IM_MAX_STRSIZE];
|
||||||
char txt[IM_MAX_STRSIZE];
|
char txt[IM_MAX_STRSIZE];
|
||||||
@ -84,42 +78,29 @@ system_image( IMAGE *im,
|
|||||||
if( log )
|
if( log )
|
||||||
*log = im_strdup( NULL, vips_buf_all( &buf ) );
|
*log = im_strdup( NULL, vips_buf_all( &buf ) );
|
||||||
|
|
||||||
if( !result ) {
|
|
||||||
IMAGE *t;
|
|
||||||
|
|
||||||
if( !(t = im_open_local( out_image, out_name, "r" )) ||
|
|
||||||
im_copy( t, out_image ) )
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
return( result );
|
return( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* im_system_image:
|
* im_system_image:
|
||||||
|
|
||||||
Run a command on an image, returning a new image.
|
Run a command on an image, returning a new image. Eg.:
|
||||||
|
|
||||||
"mycommand --dostuff %s -o %s"
|
im_system_image A2 "%s.jpg" "%s.jpg" "convert %s -swirl 45 %s"
|
||||||
|
|
||||||
have separate format strings for input and output?
|
|
||||||
|
|
||||||
"%s.jpg"
|
|
||||||
|
|
||||||
Actions:
|
Actions:
|
||||||
|
|
||||||
- create two empty temporary files
|
- create two temporary file names using the passed format strings to set type
|
||||||
- write the image to the first
|
= expand the command, using the two expanded filenames
|
||||||
|
- write the image to the first filename
|
||||||
- call system() on the expanded command
|
- call system() on the expanded command
|
||||||
- capture stdout/stderr into log
|
- capture stdout into log
|
||||||
- delete the temp input file
|
- delete the temp input file
|
||||||
|
- open the output image (the output file will be auto deleted when this
|
||||||
|
IMAGE is closed.
|
||||||
- return the output filename, or NULL if the command failed (log is still
|
- return the output filename, or NULL if the command failed (log is still
|
||||||
set in this case)
|
set in this case)
|
||||||
|
|
||||||
The caller would open the output file, either with im_open(), or with it's
|
|
||||||
own system (nip2 has it's own open file thing to give progress feedback and
|
|
||||||
use disc for format conversion), and be responsible for deleting the temp output file at some point.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IMAGE *
|
IMAGE *
|
||||||
@ -128,25 +109,41 @@ im_system_image( IMAGE *im,
|
|||||||
char **log )
|
char **log )
|
||||||
{
|
{
|
||||||
IMAGE *in_image;
|
IMAGE *in_image;
|
||||||
IMAGE *out_image;
|
char *out_name;
|
||||||
|
IMAGE *out;
|
||||||
|
|
||||||
if( log )
|
if( log )
|
||||||
*log = NULL;
|
*log = NULL;
|
||||||
|
|
||||||
if( !(in_image = im__open_temp( in_format )) )
|
if( !(in_image = im__open_temp( in_format )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
if( !(out_image = im__open_temp( out_format )) ) {
|
if( !(out_name = im__temp_name( out_format )) ) {
|
||||||
im_close( in_image );
|
im_close( in_image );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( system_image( im, in_image, out_image, cmd_format, log ) ) {
|
if( system_image( im, in_image, out_name, cmd_format, log ) ) {
|
||||||
im_close( out_image );
|
|
||||||
im_close( in_image );
|
im_close( in_image );
|
||||||
|
g_free( out_name );
|
||||||
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
im_close( in_image );
|
im_close( in_image );
|
||||||
|
|
||||||
return( out_image );
|
if( !(out = im_open( out_name, "r" )) ) {
|
||||||
|
g_free( out_name );
|
||||||
|
|
||||||
|
return( NULL );
|
||||||
|
}
|
||||||
|
if( im_add_postclose_callback( out,
|
||||||
|
(im_callback_fn) unlink, out->filename, NULL ) ) {
|
||||||
|
g_free( out_name );
|
||||||
|
im_close( out );
|
||||||
|
g_unlink( out_name );
|
||||||
|
|
||||||
|
return( NULL );
|
||||||
|
}
|
||||||
|
g_free( out_name );
|
||||||
|
|
||||||
|
return( out );
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
BIN
po/en_GB.gmo
BIN
po/en_GB.gmo
Binary file not shown.
16
po/en_GB.po
16
po/en_GB.po
@ -5,7 +5,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vips 7.20.0\n"
|
"Project-Id-Version: vips 7.20.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2010-01-14 21:04+0000\n"
|
"POT-Creation-Date: 2010-01-15 13:45+0000\n"
|
||||||
"PO-Revision-Date: Thu Nov 26 12:08:20 GMT 2009\n"
|
"PO-Revision-Date: Thu Nov 26 12:08:20 GMT 2009\n"
|
||||||
"Last-Translator: john <jcupitt@gmail.com>\n"
|
"Last-Translator: john <jcupitt@gmail.com>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
@ -1809,7 +1809,7 @@ msgstr ""
|
|||||||
msgid "func already attached"
|
msgid "func already attached"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: libvips/iofuncs/im_generate.c:684 libvips/iofuncs/im_prepare.c:184
|
#: libvips/iofuncs/im_generate.c:689 libvips/iofuncs/im_prepare.c:184
|
||||||
#: libvips/iofuncs/im_prepare.c:404
|
#: libvips/iofuncs/im_prepare.c:404
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "unable to input from a %s image"
|
msgid "unable to input from a %s image"
|
||||||
@ -1857,7 +1857,7 @@ msgstr ""
|
|||||||
msgid "flag not 0,1,2"
|
msgid "flag not 0,1,2"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: libvips/iofuncs/im_close.c:199
|
#: libvips/iofuncs/im_close.c:201
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "unable to close fd for %s"
|
msgid "unable to close fd for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -2278,28 +2278,28 @@ msgstr ""
|
|||||||
msgid "no such string field \"%s\""
|
msgid "no such string field \"%s\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: libvips/iofuncs/im_open.c:314
|
#: libvips/iofuncs/im_open.c:316
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s %s: %d%% complete"
|
msgid "%s %s: %d%% complete"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. Spaces at end help to erase the %complete message we overwrite.
|
#. Spaces at end help to erase the %complete message we overwrite.
|
||||||
#.
|
#.
|
||||||
#: libvips/iofuncs/im_open.c:332
|
#: libvips/iofuncs/im_open.c:334
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s %s: done in %ds \n"
|
msgid "%s %s: done in %ds \n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: libvips/iofuncs/im_open.c:419
|
#: libvips/iofuncs/im_open.c:421
|
||||||
msgid "NULL filename or mode"
|
msgid "NULL filename or mode"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: libvips/iofuncs/im_open.c:468
|
#: libvips/iofuncs/im_open.c:470
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "unsupported filetype \"%s\""
|
msgid "unsupported filetype \"%s\""
|
||||||
msgstr "unsupported colourspace %d"
|
msgstr "unsupported colourspace %d"
|
||||||
|
|
||||||
#: libvips/iofuncs/im_open.c:484
|
#: libvips/iofuncs/im_open.c:486
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "bad mode \"%s\""
|
msgid "bad mode \"%s\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
Loading…
Reference in New Issue
Block a user