libvips/man/im_csv2vips.3
2007-08-31 13:01:42 +00:00

77 lines
2.2 KiB
Groff

.TH IM_CSV 3 "November 2000"
.SH NAME
im_csv2vips, im_vips2csv \- read and write CSV (comma separated values) files
.SH SYNOPSIS
#include <vips/vips.h>
int im_csv2vips( const char *filename, IMAGE *out )
int im_csv2vips_header( const char *filename, IMAGE *out );
int im_vips2csv( IMAGE *in, const char *filename )
.SH DESCRIPTION
.B 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.
.B im_csv2vips_header(3)
works exactly as
.B im_csv2vips(3)
but only sets the header of the output image. It is rather slow, since it has
to read the whole input file.
.B 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).
.SH 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:\t
Convert a jpeg to CSV, separating numbers with tab characters.
.SH SEE ALSO
im_read_dmask(3), im_ppm2vips(3)
.SH COPYRIGHT
Hey, you want this? You have it!