### Constructor

# Vips Image jpegload

#### Declaration [src]

    int
    vips_jpegload (
      const char* filename,
      VipsImage** out,
      ...
    )

#### Description [src]

Read a JPEG file into a VIPS image. It can read most 8-bit JPEG images, including CMYK and YCbCr.

`shrink` means shrink by this integer factor during load. Possible values are 1, 2, 4 and 8. Shrinking during read is very much faster than decompressing the whole image and then shrinking later.

Use `fail_on` to set the type of error that will cause load to fail. By default, loaders are permissive, that is, `VIPS_FAIL_ON_NONE`.

Setting `autorotate` to `TRUE` will make the loader interpret the orientation tag and automatically rotate the image appropriately during load.

If `autorotate` is `FALSE`, the metadata field `VIPS_META_ORIENTATION` is set to the value of the orientation tag. Applications may read and interpret this field as they wish later in processing. See `vips_autorot()`. Save operations will use `VIPS_META_ORIENTATION`, if present, to set the orientation of output images.

Example:

    vips_jpegload("fred.jpg", &out,
        "shrink", 8,
        "fail_on", VIPS_FAIL_ON_TRUNCATED,
        NULL);

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 `VIPS_META_ICC_NAME`. You need to use something like `vips_icc_import()` to get CIE values from the file.

EXIF metadata is attached as `VIPS_META_EXIF_NAME`, IPTC as `VIPS_META_IPTC_NAME`, and XMP as `VIPS_META_XMP_NAME`.

The int metadata item “jpeg-multiscan” is set to the result of `jpeg_has_multiple_scans()`. Interlaced jpeg images need a large amount of memory to load, so this field gives callers a chance to handle these images differently.

The string-valued field “jpeg-chroma-subsample” gives the chroma subsample in standard notation. 4:4:4 means no subsample, 4:2:0 means YCbCr with Cb and Cr subsampled horizontally and vertically, 4:4:4:4 means a CMYK image with no subsampling.

The EXIF thumbnail, if present, is attached to the image as “jpeg-thumbnail-data”. See `vips_image_get_blob()`.

Optional arguments

- `shrink`: `gint`, shrink by this much on load
- `fail_on`: `VipsFailOn`, types of read error to fail on
- `autorotate`: `gboolean`, use exif Orientation tag to rotate the image during load

See also

`vips_jpegload_buffer()`, `vips_autorot()`.

This constructor is not directly available to language bindings.

#### Parameters

`filename`

  Type: `const char*`

  File to load.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`out`

  Type: `VipsImage`

  Decompressed image.

  The argument will be set by the function.
  The caller of the function takes ownership of the returned data, and is responsible for freeing it.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.