libvips/man/im_jpeg2vips.3

76 lines
2.5 KiB
Groff

.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
.B im_jpeg2vips(3)
reads the named jpeg file and writes it to the specified
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:
filename.jpg:<shrink-factor>
.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.
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.
Any EXIF data is also attached as VIPS metadata.
.B im_vips2jpeg(3)
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,
"fred.jpg:25,/home/john/srgb.icc" will embed the profile stored in the file
"/home/john/srgb.icc" into the JPEG image. This does not affect the pixels
which are written; just the way they are tagged.
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
profile from the header will be attached.
The image is automatically converted to RGB or Monochrome before saving. Any
metadata attached to the image is saved as EXIF, if possible.
.B im_vips2bufjpeg(3)
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.
.B im_vips2mimejpeg(3)
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
im_open(3).