Vips.Image.generate

### Method

# Vips Imagegenerate

#### Declaration [src]

    int
    vips_image_generate (
      VipsImage* image,
      VipsStartFn start_fn,
      VipsGenerateFn generate_fn,
      VipsStopFn stop_fn,
      void* a,
      void* b
    )

#### Description [src]

Generates an image. The action depends on the image type.

For images created with `vips_image_new()`, `vips_image_generate()` just attaches the start/generate/stop callbacks and returns.

For images created with `vips_image_new_memory()`, memory is allocated for the whole image and it is entirely generated using `vips_sink_memory()`.

For images created with `vips_image_new_temp_file()` and friends, memory for a few scanlines is allocated and `vips_sink_disc()` used to generate the image in small chunks. As each chunk is generated, it is written to disc.

See also

`vips_sink_memory()`, `vips_image_new()`, `vips_region_prepare()`.

#### Parameters

`start_fn`

  Type: `VipsStartFn`

  Start sequences with this function.

`generate_fn`

  Type: `VipsGenerateFn`

  Generate pixels with this function.

`stop_fn`

  Type: `VipsStopFn`

  Stop sequences with this function.

`a`

  Type: `void*`

  User data.

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

`b`

  Type: `void*`

  User data.

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

#### Return value

Type: `int`

0 on success, or -1 on error.