NAME
im_csv2vips, im_vips2csv - read and write CSV (comma separated values)
files
SYNOPSIS
#include <vips/vips.h>
int im_csv2vips( const char *filename, IMAGE *out )
int im_vips2csv( IMAGE *in, const char *filename )
DESCRIPTION
im_csv2vips(3) reads the CSV (comma separated values) data in filename,
and writes the image out in VIPS format. The output image is always 1
band (monochrome), IM_BANDFMT_DOUBLE.
The reader is deliberately rather fussy: it will fail if there are any
short lines, or if the file is too short. It will ignore lines that are
too long.
Read options can be embedded in the filename. The options can be given
in any order and are:
skip:lines-to-skip
The number of lines to skip at the start of the file. Default zero.
whi:whitespace-characters
The skippable whitespace characters. Default <space> and double quotes
("). Whitespace characters are always run together.
sep:separator-characters
The characters that separate fields. Default ;,<tab>. Separators are
never run together.
line:lines-to-read
The number of lines to read from the file. Default -1, meaning read to
end of file.
im_vips2csv(3) writes the VIPS image to the file as ascii text, one
line of text per scanline. Complex numbers are written as
"(real,imaginary)" and will need extra parsing I guess.
Write options can be embedded in the filename. The options can be given
in any order and are:
sep:separator-string
The string to use to separate numbers in the output. The default is
"\t" (tab).
EXAMPLES
im_csv2vips( "fred.csv:skip:58,sep:,line:3", out );
Will read three lines starting at line 59, with space, comma and tab as
the allowed separators. Note that the ’,’ has to be escaped with a
backslash.
im_vips2csv fred.jpg fred.csv:sep:
Convert a jpeg to CSV, separating numbers with tab characters.
SEE ALSO
im_read_dmask(3), im_ppm2vips(3)
COPYRIGHT
Hey, you want this? You have it!
November 2000 IM_CSV(3)