Constructor
VipsImagesystem
Declaration [src]
int
vips_system (
const char* cmd_format,
...
)
Description [src]
Optional arguments
in
: array of input imagesout
: output imagein_format
: write input files like thisout_format
: write output filename like thislog
: stdout of command is returned here
vips_system()
runs a command, optionally passing a set of images in and
optionally getting an image back. The command’s stdout is returned in log
.
First, if in
is set, the array of images are written to files. See
vips_image_new_temp_file()
to see how temporary files are created.
If in_format
is something like %s.png
, the file will be written in PNG
format. By default, in_format
is %s.tif
.
If out_format
is set, an output filename is formed in the same way. Any
trailing [options]
are stripped from out_format
.
The command string to run is made by substituting the first set of %s
in cmd_format
for the names of the input files, if in
is set, and then
the next %s
for the output filename, if out_format
is set.
You can put a number between the %
and the s
to change the order
in which the substitution occurs.
The command is executed with popen()
and the output captured in log
.
After the command finishes, if out_format
is set, the output image is
opened and returned in out
. You can append [options]
to out_format
to
control how this open happens.
Closing out
image will automatically delete the output file.
Finally the input images are deleted.
For example, this call will run the ImageMagick convert program on an image, using JPEG files to pass images into and out of the convert command.
VipsArrayImage *in;
VipsImage *out;
char *log;
if (vips_system("convert %s -swirl 45 %s",
"in", in,
"out", &out,
"in_format", "%s.jpg",
"out_format", "%s.jpg",
"log", &log,
NULL))
error ...
This constructor is not directly available to language bindings.