CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K
components in the source image are reordered into image planes, but no
colorspace conversion or subsampling is performed. CMYK JPEG images can
only be compressed from and decompressed to packed-pixel images with the
CMYK pixel format.
Grayscale colorspace. The JPEG image retains only the luminance data (Y
component), and any color data from the source image is discarded.
Grayscale JPEG images can be compressed from and decompressed to
packed-pixel images with any of the extended RGB or grayscale pixel
formats, or they can be compressed from and decompressed to planar YUV
images.
RGB colorspace. When compressing the JPEG image, the R, G, and B
components in the source image are reordered into image planes, but no
colorspace conversion or subsampling is performed. RGB JPEG images can be
compressed from and decompressed to packed-pixel images with any of the
extended RGB or grayscale pixel formats, but they cannot be compressed
from or decompressed to planar YUV images.
YCCK colorspace. YCCK (AKA “YCbCrK”) is not an absolute colorspace but
rather a mathematical transformation of CMYK designed solely for storage
and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be
reversibly transformed into YCCK, and as with YCbCr, the chrominance
components in the YCCK pixels can be subsampled without incurring major
perceptual loss. YCCK JPEG images can only be compressed from and
decompressed to packed-pixel images with the CMYK pixel format.
YCbCr colorspace. YCbCr is not an absolute colorspace but rather a
mathematical transformation of RGB designed solely for storage and
transmission. YCbCr images must be converted to RGB before they can
actually be displayed. In the YCbCr colorspace, the Y (luminance)
component represents the black & white portion of the original image, and
the Cb and Cr (chrominance) components represent the color portion of the
original image. Originally, the analog equivalent of this transformation
allowed the same signal to drive both black & white and color televisions,
but JPEG images use YCbCr primarily because it allows the color data to be
optionally subsampled for the purposes of reducing network or disk usage.
YCbCr is the most common JPEG colorspace, and YCbCr JPEG images can be
compressed from and decompressed to packed-pixel images with any of the
extended RGB or grayscale pixel formats. YCbCr JPEG images can also be
compressed from and decompressed to planar YUV images.
The error was fatal and non-recoverable.
The error was non-fatal and recoverable, but the destination image may
still be corrupt.
Initialize the TurboJPEG instance for compression.
Initialize the TurboJPEG instance for decompression.
Initialize the TurboJPEG instance for lossless transformation (both
compression and decompression.)
Arithmetic entropy coding
Row order in packed-pixel source/destination images
JPEG colorspace
JPEG pixel density units
DCT/IDCT algorithm [lossy compression and decompression]
Chrominance upsampling algorithm [lossy decompression only]
JPEG height (in pixels) [decompression only, read-only]
JPEG width (in pixels) [decompression only, read-only]
Lossless JPEG
Lossless JPEG predictor selection value (PSV)
Lossless JPEG point transform (Pt)
JPEG destination buffer (re)allocation [compression, lossless
transformation]
Optimized baseline entropy coding [lossy compression only]
JPEG data precision (bits per sample) [decompression only, read-only]
Progressive entropy coding
Perceptual quality of lossy JPEG images [compression only]
JPEG restart marker interval in MCU blocks (lossy) or samples (lossless)
[compression only]
JPEG restart marker interval in MCU rows (lossy) or sample rows (lossless)
[compression only]
Progressive JPEG scan limit for lossy JPEG images [decompression, lossless
transformation]
Error handling behavior
Chrominance subsampling level
JPEG horizontal pixel density
JPEG vertical pixel density
ABGR pixel format. This is the same as @ref TJPF_XBGR, except that when
decompressing, the X component is guaranteed to be equal to the maximum
sample value, which can be interpreted as an opaque alpha channel.
ARGB pixel format. This is the same as @ref TJPF_XRGB, except that when
decompressing, the X component is guaranteed to be equal to the maximum
sample value, which can be interpreted as an opaque alpha channel.
BGR pixel format. The red, green, and blue components in the image are
stored in 3-sample pixels in the order B, G, R from lowest to highest
memory address within each pixel.
BGRA pixel format. This is the same as @ref TJPF_BGRX, except that when
decompressing, the X component is guaranteed to be equal to the maximum
sample value, which can be interpreted as an opaque alpha channel.
BGRX pixel format. The red, green, and blue components in the image are
stored in 4-sample pixels in the order B, G, R from lowest to highest
memory address within each pixel. The X component is ignored when
compressing and undefined when decompressing.
CMYK pixel format. Unlike RGB, which is an additive color model used
primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive
color model used primarily for printing. In the CMYK color model, the
value of each color component typically corresponds to an amount of cyan,
magenta, yellow, or black ink that is applied to a white background. In
order to convert between CMYK and RGB, it is necessary to use a color
management system (CMS.) A CMS will attempt to map colors within the
printer’s gamut to perceptually similar colors in the display’s gamut and
vice versa, but the mapping is typically not 1:1 or reversible, nor can it
be defined with a simple formula. Thus, such a conversion is out of scope
for a codec library. However, the TurboJPEG API allows for compressing
packed-pixel CMYK images into YCCK JPEG images (see #TJCS_YCCK) and
decompressing YCCK JPEG images into packed-pixel CMYK images.
Grayscale pixel format. Each 1-sample pixel represents a luminance
(brightness) level from 0 to the maximum sample value (255 for 8-bit
samples, 4095 for 12-bit samples, and 65535 for 16-bit samples.)
RGB pixel format. The red, green, and blue components in the image are
stored in 3-sample pixels in the order R, G, B from lowest to highest
memory address within each pixel.
RGBA pixel format. This is the same as @ref TJPF_RGBX, except that when
decompressing, the X component is guaranteed to be equal to the maximum
sample value, which can be interpreted as an opaque alpha channel.
RGBX pixel format. The red, green, and blue components in the image are
stored in 4-sample pixels in the order R, G, B from lowest to highest
memory address within each pixel. The X component is ignored when
compressing and undefined when decompressing.
Unknown pixel format. Currently this is only used by #tj3LoadImage8(),
#tj3LoadImage12(), and #tj3LoadImage16().
XBGR pixel format. The red, green, and blue components in the image are
stored in 4-sample pixels in the order R, G, B from highest to lowest
memory address within each pixel. The X component is ignored when
compressing and undefined when decompressing.
XRGB pixel format. The red, green, and blue components in the image are
stored in 4-sample pixels in the order B, G, R from highest to lowest
memory address within each pixel. The X component is ignored when
compressing and undefined when decompressing.
4:1:1 chrominance subsampling. The JPEG or YUV image will contain one
chrominance component for every 4x1 block of pixels in the source image.
JPEG images compressed with 4:1:1 subsampling will be almost exactly the
same size as those compressed with 4:2:0 subsampling, and in the
aggregate, both subsampling methods produce approximately the same
perceptual quality. However, 4:1:1 is better able to reproduce sharp
horizontal features.
4:2:0 chrominance subsampling. The JPEG or YUV image will contain one
chrominance component for every 2x2 block of pixels in the source image.
4:2:2 chrominance subsampling. The JPEG or YUV image will contain one
chrominance component for every 2x1 block of pixels in the source image.
4:4:0 chrominance subsampling. The JPEG or YUV image will contain one
chrominance component for every 1x2 block of pixels in the source image.
4:4:1 chrominance subsampling. The JPEG or YUV image will contain one
chrominance component for every 1x4 block of pixels in the source image.
JPEG images compressed with 4:4:1 subsampling will be almost exactly the
same size as those compressed with 4:2:0 subsampling, and in the
aggregate, both subsampling methods produce approximately the same
perceptual quality. However, 4:4:1 is better able to reproduce sharp
vertical features.
4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG or
YUV image will contain one chrominance component for every pixel in the
source image.
Grayscale. The JPEG or YUV image will contain no chrominance components.
Unknown subsampling. The JPEG image uses an unusual type of chrominance
subsampling. Such images can be decompressed into packed-pixel images,
but they cannot be
Flip (mirror) image horizontally. This transform is imperfect if there
are any partial MCU blocks on the right edge (see #TJXOPT_PERFECT.)
Do not transform the position of the image pixels
Rotate image clockwise by 90 degrees. This transform is imperfect if
there are any partial MCU blocks on the bottom edge (see
#TJXOPT_PERFECT.)
Rotate image 180 degrees. This transform is imperfect if there are any
partial MCU blocks in the image (see #TJXOPT_PERFECT.)
Rotate image counter-clockwise by 90 degrees. This transform is imperfect
if there are any partial MCU blocks on the right edge (see
#TJXOPT_PERFECT.)
Transpose image (flip/mirror along upper left to lower right axis.) This
transform is always perfect.
Transverse transpose image (flip/mirror along upper right to lower left
axis.) This transform is imperfect if there are any partial MCU blocks in
the image (see #TJXOPT_PERFECT.)
Flip (mirror) image vertically. This transform is imperfect if there are
any partial MCU blocks on the bottom edge (see #TJXOPT_PERFECT.)
Allocate a byte buffer for use with TurboJPEG. You should always use this
function to allocate the JPEG destination buffer(s) for the compression and
transform functions unless you are disabling automatic buffer (re)allocation
(by setting #TJPARAM_NOREALLOC.)
Compress an 8-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into
an 8-bit-per-sample JPEG image.
Compress a 12-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into
a 12-bit-per-sample JPEG image.
Compress a 16-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into
a 16-bit-per-sample lossless JPEG image.
Compress an 8-bit-per-sample unified planar YUV image into an
8-bit-per-sample JPEG image.
Compress a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes into
an 8-bit-per-sample JPEG image.
Decode an 8-bit-per-sample unified planar YUV image into an 8-bit-per-sample
packed-pixel RGB or grayscale image. This function performs color
conversion (which is accelerated in the libjpeg-turbo implementation) but
does not execute any of the other steps in the JPEG decompression process.
Decode a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes into an
8-bit-per-sample packed-pixel RGB or grayscale image. This function
performs color conversion (which is accelerated in the libjpeg-turbo
implementation) but does not execute any of the other steps in the JPEG
decompression process.
Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample
packed-pixel RGB, grayscale, or CMYK image. The @ref TJPARAM “parameters”
that describe the JPEG image will be set when this function returns.
Decompress a 12-bit-per-sample JPEG image into a 12-bit-per-sample
packed-pixel RGB, grayscale, or CMYK image.
Decompress a 16-bit-per-sample lossless JPEG image into a 16-bit-per-sample
packed-pixel RGB, grayscale, or CMYK image.
Retrieve information about a JPEG image without decompressing it, or prime
the decompressor with quantization and Huffman tables. If a JPEG image is
passed to this function, then the @ref TJPARAM “parameters” that describe
the JPEG image will be set when the function returns.
Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample unified
planar YUV image. This function performs JPEG decompression but leaves out
the color conversion step, so a planar YUV image is generated instead of a
packed-pixel image. The @ref TJPARAM “parameters” that describe the JPEG
image will be set when this function returns.
Decompress an 8-bit-per-sample JPEG image into separate 8-bit-per-sample Y,
U (Cb), and V (Cr) image planes. This function performs JPEG decompression
but leaves out the color conversion step, so a planar YUV image is generated
instead of a packed-pixel image. The @ref TJPARAM “parameters” that
describe the JPEG image will be set when this function returns.
Destroy a TurboJPEG instance.
Encode an 8-bit-per-sample packed-pixel RGB or grayscale image into an
8-bit-per-sample unified planar YUV image. This function performs color
conversion (which is accelerated in the libjpeg-turbo implementation) but
does not execute any of the other steps in the JPEG compression process.
Encode an 8-bit-per-sample packed-pixel RGB or grayscale image into separate
8-bit-per-sample Y, U (Cb), and V (Cr) image planes. This function performs
color conversion (which is accelerated in the libjpeg-turbo implementation)
but does not execute any of the other steps in the JPEG compression process.
Free a byte buffer previously allocated by TurboJPEG. You should always use
this function to free JPEG destination buffer(s) that were automatically
(re)allocated by the compression and transform functions or that were
manually allocated using #tj3Alloc().
Get the value of a parameter.
Returns a code indicating the severity of the last error. See
@ref TJERR “Error codes”.
Returns a descriptive error message explaining why the last command failed.
Returns a list of fractional scaling factors that the JPEG decompressor
supports.
Create a new TurboJPEG instance.
The maximum size of the buffer (in bytes) required to hold a JPEG image with
the given parameters. The number of bytes returned by this function is
larger than the size of the uncompressed source image. The reason for this
is that the JPEG format uses 16-bit coefficients, so it is possible for a
very high-quality source image with very high-frequency content to expand
rather than compress when converted to the JPEG format. Such images
represent very rare corner cases, but since there is no way to predict the
size of a JPEG image prior to compression, the corner cases have to be
handled.
Load an 8-bit-per-sample packed-pixel image from disk into memory.
Load a 12-bit-per-sample packed-pixel image from disk into memory.
Load a 16-bit-per-sample packed-pixel image from disk into memory.
Save an 8-bit-per-sample packed-pixel image from memory to disk.
Save a 12-bit-per-sample packed-pixel image from memory to disk.
Save a 16-bit-per-sample packed-pixel image from memory to disk.
Set the value of a parameter.
Set the cropping region for partially decompressing a lossy JPEG image into
a packed-pixel image
Set the scaling factor for subsequent lossy decompression operations.
Losslessly transform a JPEG image into another JPEG image. Lossless
transforms work by moving the raw DCT coefficients from one JPEG image
structure to another without altering the values of the coefficients. While
this is typically faster than decompressing the image, transforming it, and
re-compressing it, lossless transforms are not free. Each lossless
transform requires reading and performing entropy decoding on all of the
coefficients in the source image, regardless of the size of the destination
image. Thus, this function provides a means of generating multiple
transformed images from the same source or applying multiple transformations
simultaneously, in order to eliminate the need to read the source
coefficients multiple times.
The size of the buffer (in bytes) required to hold a unified planar YUV
image with the given parameters.
The plane height of a YUV image plane with the given parameters. Refer to
@ref YUVnotes “YUV Image Format Notes” for a description of plane height.
The size of the buffer (in bytes) required to hold a YUV image plane with
the given parameters.
The plane width of a YUV image plane with the given parameters. Refer to
@ref YUVnotes “YUV Image Format Notes” for a description of plane width.