### Method

# AppStreamCompose Media process_image

since: 1.2.0

#### Declaration [src]

    gboolean
    asc_media_process_image (
      AscMedia* media,
      AscImageSource* source,
      GPtrArray* targets,
      const gchar* out_dir,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Load an image (in the media worker process) and store an arbitrary set of scaled renditions of it in the given output directory. The directory is created if it does not exist yet.

On success, the dimensions the source image was loaded at are recorded in `source`, and the result fields of all `targets` are updated. Individual renditions may still have failed - this is recorded in their error message and does not affect the return value of this function.

Cancelling this operation terminates the media worker process, as its pending reply would otherwise desynchronize the next request. A fresh worker is spawned automatically for the next operation.

Available since: 1.2.0

#### Parameters

`source`

  Type: `AscImageSource`

  The `AscImageSource` describing the image to process.

  The data is owned by the caller of the method.

`targets`

  Type: An array of `AscImageTarget*`

  Renditions to generate, or `NULL` to just read image info.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`out_dir`

  Type: `const gchar*`

  Directory to store the renditions in, may be `NULL` if `targets` is empty.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` if the image was processed.