---
name: "im_system"
section: "3"
platform: "linux"
package: "libvips-dev"
version: "7.20.7-1+b3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/im_system"
---

# im\_system(3)

run a command on an image

## NAME

im\_system - run a command on an image

## SYNOPSIS

\#include \<vips/vips.h\>

int im\_system(im, cmd, out)\
 IMAGE \*im;\
 const char \*cmd;\
 char \*\*out;

## DESCRIPTION

**im\_system()** runs a command on an image, returning the command's output as a string. This string should be freed with  **im\_free()** when you've finished with it.

The command is executed with the  **[system(3)](/system/3.md)** call; the first '%s' in the command being substituted for a filename.

For example:

im\_system( im, "vips2dj %s \| lpr", &result )

will run the command [vips2dj(1)](/vips2dj/1.md) on the image, piping the result to the printer.

If the IMAGE is a file on disc, then the filename will be the name of the real file. If the image is in memory, or the result of a computation, then a new file is created in the temporary area called something like "vips\_XXXXXX", and that filename given to the command. The file is deleted when the command finishes.

The environment variable TMPDIR can be used to set the temporary directory. If it is not set, it defaults to "/tmp".

## RETURN VALUE

The function returns 0 on success and -1 on error.

## SEE ALSO

[system(3)](/system/3.md), [vips2dj(1)](/vips2dj/1.md)

## COPYRIGHT

2000 The National Gallery and Birkbeck College
