IM_JPEG2VIPS(3)

NAME
im_jpeg2vips, im_vips2jpeg, im_vips2bufjpeg, im_vips2mimejpeg - convert JPEG images to and from VIPS format

SYNOPSIS
#include <vips/vips.h> int im_jpeg2vips( char *filename, IMAGE *out ) int im_jpeg2vips_header( 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 )

DESCRIPTION
im_jpeg2vips() 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> 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. im_jpeg2vips_header() reads just the header of the JPEG file (including any EXIF data), and sets the fields in the VIPS image. You can't read any pixels! This is only useful for printing header information. im_vips2jpeg() 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. im_vips2bufjpeg() returns the compressed image in a memory buffer. The buffer is allocated for you, local to IMAGE descriptor base. The size of the allocated buffer is returned in the olen parameter. You are responsible for freeing the buffer. The buffer is only allocated if the function returns successfully. im_vips2mimejpeg() 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.

SEE ALSO
im_isjpeg(3).