Function

Vipscsvload

Declaration [src]

int
vips_csvload (
  const char* filename,
  VipsImage** out,
  ...
)

Description [src]

Optional arguments:

  • skip: skip this many lines at start of file
  • lines: read this many lines from file
  • whitespace: set of whitespace characters
  • separator: set of separator characters
  • fail_on: VipsFailOn, types of read error to fail on

Load a CSV (comma-separated values) file. The output image is always 1 band (monochrome), #VIPS_FORMAT_DOUBLE. Use vips_bandfold() to turn RGBRGBRGB mono images into colour iamges.

Items in lines can be either floating point numbers in the C locale, or strings enclosed in double-quotes (“), or empty. You can use a backslash () within the quotes to escape special characters, such as quote marks.

skip sets the number of lines to skip at the start of the file. Default zero.

lines sets the number of lines to read from the file. Default -1, meaning read all lines to end of file.

whitespace sets the skippable whitespace characters. Default space. Whitespace characters are always run together.

separator sets the characters that separate fields. Default ;,tab. Separators are never run together.

Use fail_on to set the type of error that will cause load to fail. By default, loaders are permissive, that is, #VIPS_FAIL_ON_NONE.

See also: vips_image_new_from_file(), vips_bandfold().

This function is not directly available to language bindings

Parameters

filename const char*
 

File to load.

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

Output image.

 The argument will be set by the function.
 The called function takes ownership of the data, and is responsible for freeing it.
...
 

NULL-terminated list of optional named arguments.

Return value

Returns: int
 

0 on success, -1 on error.