libvips/man/im_jpeg2vips.3

87 lines
2.9 KiB
Groff
Raw Normal View History

2007-08-29 18:23:50 +02:00
.TH IM_JPEG2VIPS 3 "6 June 1994"
.SH NAME
im_jpeg2vips, im_vips2jpeg, im_vips2bufjpeg, im_vips2mimejpeg \- convert JPEG images to and from VIPS format
.SH SYNOPSIS
#include <vips/vips.h>
int im_jpeg2vips( char *filename, IMAGE *out )
int im_vips2jpeg( IMAGE *in, char *filename )
int im_vips2bufjpeg( IMAGE *in, IMAGE *base, char **obuf, int *olen )
int im_vips2mimejpeg( IMAGE *in )
.SH DESCRIPTION
2008-08-16 19:19:59 +02:00
.B im_jpeg2vips(3)
2007-08-29 18:23:50 +02:00
reads the named jpeg file and writes it to the specified
2008-02-15 19:07:39 +01:00
IMAGE. The entire image is read before returning. It can read most 8-bit JPEG
images, including CMYK.
You can embed options in the filename. They have the form:
2009-06-16 14:58:18 +02:00
filename.jpg:<shrink-factor>,<fail>
2008-02-15 19:07:39 +01:00
.B shrink-factor
will shrink the image by that factor during read. Allowed values are 1, 2, 4
and 8. Shrinking during read is very much faster than decompressing the whole
image and then shrinking. Example:
fred.jpg:8
will return fred.jpg shrink by a factor of 8.
2007-08-29 18:23:50 +02:00
2009-06-16 14:58:18 +02:00
.B fail
makes the JPEG reader fail on any warnings. This can be useful for detecting
2009-08-13 17:26:35 +02:00
truncated files, for example. Normally reading these produces a warning, but
2009-06-16 14:58:18 +02:00
no fatal error. Example:
fred.jpg:,fail
will read fred.jpg, failing with a fatal error if the file has been truncated.
2007-08-29 18:23:50 +02:00
Any embedded ICC profiles are ignored: you always just get the RGB from the
file. Instead, the embedded profile will be attached to the image as metadata.
2009-08-13 17:26:35 +02:00
You need to use something like im_icc_import(3) to get CIE values from the
file. Any EXIF data is also attached as VIPS metadata.
2007-08-29 18:23:50 +02:00
2008-08-16 19:19:59 +02:00
.B im_vips2jpeg(3)
2007-08-29 18:23:50 +02:00
writes the IMAGE to filename in JPEG format. It uses the
default settings of the IJG library.
A compression factor may be encoded in the filename: for example,
"fred.jpg" will write with the default compression factor (75),
"fred.jpg:25" will write with factor 25.
An ICC profile may also be specified. For example,
2009-08-13 17:26:35 +02:00
"fred.jpg:,/home/john/srgb.icc" will embed the profile stored in the file
2007-08-29 18:23:50 +02:00
"/home/john/srgb.icc" into the JPEG image. This does not affect the pixels
2009-08-13 17:26:35 +02:00
which are written, just the way they are tagged. You can use the special
string "none" to mean "don't attach a profile".
2007-08-29 18:23:50 +02:00
If no profile is specified in the save string and the VIPS header contains an
ICC profile named IM_META_ICC_NAME ("icc-profile-data"), the
2009-08-13 17:26:35 +02:00
profile from the VIPS header will be attached.
2007-08-29 18:23:50 +02:00
2009-08-13 17:26:35 +02:00
The image is automatically converted to RGB, Monochrome or CMYK before saving.
Any metadata attached to the image is saved as EXIF, if possible.
2007-08-29 18:23:50 +02:00
2008-08-16 19:19:59 +02:00
.B im_vips2bufjpeg(3)
2007-08-29 18:23:50 +02:00
returns the compressed image in a memory buffer. The buffer
is allocated for you, local to IMAGE descriptor
.B base.
The size of the
allocated buffer is returned in the
.B olen
parameter. You are responsible for
freeing the buffer. The buffer is only allocated if the function returns
successfully.
2008-08-16 19:19:59 +02:00
.B im_vips2mimejpeg(3)
2007-08-29 18:23:50 +02:00
writes the image to stdout as a MIME image/jpeg type. It
outputs Content-Length and Content-Type fields making the result suitable for
sending to a web browser.
.SH SEE ALSO
2008-08-16 19:19:59 +02:00
im_open(3).