DIPlib Documentation - ©1995-2017 Quantitative Imaging Group, Delft University of Technology.

ImageWriteJPEG

Write JPEG image to file (in dipIO)

SYNOPSIS

#include "dipio_jpeg.h"

dip_Error ImageWriteJPEG ( image, filename, photometric, physDims, complevel )

FUNCTION

This function writes the image to a JPEG file, overwriting any other file with the same name. photometric can set to let the function know how to write the JPEG image (supported colour space is RGB).

If photometric is not DIPIO_PHM_GRAYVALUE, a 3D image is expected, in which the different planes are stored along the 3rd dimension.

physDims gives physical dimensions of the image, which will be used to set the dots per inch property of the JPEG file. It can be set to 0 for default values (300 dpi). If the physDims->dimensionUnits is not given, meters are assumed.

complevel is a number between 1 (worst quality, smallest files) and 100 (best quality, largest files). Setting complevel to 0 uses the default compression level, which is 90.

ARGUMENTS

Data typeNameDescription
dip_ImageimageOutput image
dip_StringfilenameFile name
dipio_PhotometricInterpretationphotometricPhotometric interpretation
dip_PhysicalDimensionsphysDimsPhysical dimensions structure. See PhysicalDimensionsNew
dipio_uintcomplevelCompression level

The enumerator dipio_PhotometricInterpretation contains the following constants:

NameDescription
DIPIO_PHM_GREYVALUENo colour information present; it's a grey-value image.
DIPIO_PHM_RGBRGB image (the first three planes are red, green and blue)
DIPIO_PHM_RGB_NONLINEARNon-linear R'G'B' image (RGB channels to the power of 0.4)
DIPIO_PHM_CMYCMY image (the first three planes are cyan, magenta and yellow)
DIPIO_PHM_CMYKCMYK image (the first four planes are cyan, magenta, yellow and black)
DIPIO_PHM_CIELUVCIE L*u'v' image (the first three planes are luminosity, u* and v*)
DIPIO_PHM_CIELABCIE L*a*b* image (the first three planes are luminosity, a* and b*)
DIPIO_PHM_CIEXYZCIE XYZ (the first three planes are X, Y and Z)
DIPIO_PHM_CIEYXYCIE Yxy (the first three planes are Y, x and y)
DIPIO_PHM_HCVHCV image (the first three planes are hue, chroma and value)
DIPIO_PHM_HSVHSV image (the first three planes are hue, saturation and value)
DIPIO_PHM_DEFAULTSame as DIPIO_PHM_GREYVALUE
DIPIO_PHM_GENERICAnything can be coded in the channels; the same as DIPIO_PHM_CMYK

Most file formats support only some of these.

SOFTWARE

This function uses libjpeg (version 6b or later). Copyright (c)1994-1998, Thomas G. Lane.

SEE ALSO

ImageWrite, ImageWriteColour, ImageReadJPEG, ImageIsJPEG, ImageReadJPEGInfo