ImageGear for .NET
JPEG
Send Feedback
ImageGear for .NET User Guide > ImageGear Imaging Formats Reference > ImageGear Supported File Formats Reference > JPEG

Glossary Item Box

Full Name JPEG File Interchange Format
Format ID ImGearFormats.JPG
File Extension(s) *.ipg, *jpeg
Data Type Raster Image
Data Encoding Binary
IG Multipage Support No
IG Alpha Channel Support Read/write
IG Metadata Update Support Page
IG Platforms Support WIN32, WIN64, Unix, Unix64, .NET, .NET64, MAC, Java, Silverlight

ImageGear Supported Versions

ImageGear Supported Features

ImageGear Read Support

ImageGear Write Support

ImageGear Filter Control Parameters

Filter Control Parameter Type Default Value Available Values Description
AllowLossy12bpcSaving bool true true, false Controls the saving to Lossy JPEG format. If True, saving of 12 bits per channel Lossy JPEG is allowed. This is the maximum channel depth supported by Lossy JPEG format. If source image's depth is more than 8 bits per channel, it will be saved to a 12 bpc JPEG. For example, 48-bit RGB image will be saved to 36-bit JPEG. Note that many viewers do not support 12 bpc JPEG. If False, all images are saved to 8 bpc JPEG, regardless of their channel depth.
AllowRGBASaving bool true true, false Set this parameter to true to enable RGBA JPEG saving. Note, that there is no official standard for RGBA JPEG. This format is recognized as CMYK rather than RGBA by most third-party software.
Quality int 70 Possible value in range [1,100] Gets/Sets quality value for Lossy and Progressive JPEG compression. See See JPEG Quality. Section for details.
DecimationType ImGearDecimationTypes Enumeration Decim_2x2_1x1_1x1 ImGearDecimationTypes Enumeration Get/Set decimation value. For all available values see ImGearDecimationTypes Enumeration.
Predictor int 1   Gets/Sets predictor for lossless JPEG. See See Lossless JPEG Predictor Settings. Section for details.
SaveType int 0 (Lossy compression) 0 (Lossy compression),

1 (Lossless compression),

2 (Progressive compression)
Get/Set type for output JPEG format. See See Loading and Saving JPEG-Compressed Images. Section for details.
AllowCMYKSaving bool true true, false Set to true (default) to allow saving JPEG CMYK images. Set to false to save CMYK images to JPEG as RGB.
SaveEXIFMetadata bool false true,

false
If true. EXIF metadata is saved.
SaveExistingEXIFMetadata bool true true, false This parameter controls the saving of existing EXIF metadata.

By default (SaveEXIFMetadata = False, SaveExistingEXIFMetadata = True), ImageGear saves EXIF metadata if it exists in the source page, and does not save EXIF metadata if it does not exist in the source page.
QuadComponentColorSpace ImGearQuadComponentColorSpace Enumeration Auto Auto, Rgba, Cmyk, Ycck This parameter allows you to explicitly specify the color space of the quad component JPEG image on load. Set this parameter to “Auto” to let ImageGear detect the best suitable color space, or set it to any other enumeration value to explicitly specify the color space. Please see ImGearQuadComponentColorSpace Enumeration for more details.

SaveExistingEXIFMetadata works in combination with SaveEXIFMetadata parameter, as shown in the table below:

SaveEXIFMetadata SaveExistingEXIFMetadata Source Page has EXIF Metadata ImageGear Action
False False No Does not save EXIF metadata
False False Yes Does not save EXIF metadata
False True No Does not save EXIF metadata
False True Yes Saves existing EXIF metadata
True False No Saves default EXIF metadata
True False Yes Ignores existing and saves default EXIF metadata
True True No Saves default EXIF metadata
True True Yes Saves existing EXIF metadata

Comments

JPEG is normally associated with the JPEG compression scheme, but it is also implemented into the JFIF file format. This format was developed to store JPEG-encoded data, and to exchange it between applications or operating systems that are normally incompatible.

The JPEG compression scheme was developed by the Joint Photographic Experts Group (created by the joining of a subgroup of the International Standards Organizations, called PEG (Photographic Experts Group) and a subgroup of the CCITT). Their common goal was to produce a standard for the transmission of graphics image data over networks and through color facsimile systems.

The header of the JFIF contains the version number, the image dots per inch (DPI), or dots per centimeter, and an optional thumbnail (miniature) RGB representation of the main image. Version 1.02 handles thumbnails differently by storing them separately, rather than in the identification marker of the header.

The raw JPEG data is surrounded by two markers, an "SOI" (start of image) marker, and an "EOI" (end of image) marker. See JPEG Compression for more about JPEG compression.

JFIF is considered a non-proprietary file format. Many proprietary file formats contain JPEG data, incorporating their own application-specific data structures. Another non-proprietary format that uses JPEG-encoded data is TIFF file format, version 6.0.

Loading and Saving JPEG-Compressed Images

ImageGear supports the reading and writing of three types of JPEG compression: baseline JPEG (Lossy), Progressive JPEG, and Lossless JPEG. When you load a JPEG-compressed file, ImageGear detects the type of JPEG compression and decompress the image automatically. But if you want to save an image with a JPEG compression scheme other than baseline JPEG, you must use the "SaveType" parameter to specify the type of JPEG compression.

JPEG Thumbnails

The JPEG format can store thumbnails, which are small representations of the original image. These images are stored in uncompressed form and can significantly decrease your overall compression ratio. (Uncompressed thumbnails sometimes occupy more space than the original JPEG image when compressed). Use this option carefully.

The JPEG format does not allow the storage of "large" thumbnails. This is due to the marker segment length, which cannot be greater than 65,536 bytes. The maximum size of a color thumbnail is about 100x200 or 200x100 pixels, and the maximum size of a grayscale thumbnail is about 300x200 or 200x300 pixels.

Lossless JPEG Predictor Settings

The Lossless JPEG scheme is "predictive" in nature; it uses the values of surrounding pixels in addition to the value of the original pixel to calculate a predictor value, which it then subtracts from the value of the original pixel. The resulting pixel value will be reduced such that it can be compressed more than the original value. The higher the number of neighboring pixels used, the higher the compression will be.

Regardless of the predictor value setting, the quality of the image will remain the same. The difference is that if you choose to optimize for space by setting a high predictor value, you will have to give up some speed, as the decompression will take longer to perform.

ImageGear lets you set the predictor value using "Predictor" control parameter. The ImageGear default for this setting is 1. The allowed range is 1--7. The graphic below shows a predictor (x) and three reconstructed samples (a,b,c) immediately to the left, immediately above, and diagonally to the left of the current sample

Lossless JPEG does not apply DCT for an image as per the Lossy JPEG compression. Instead, it uses a DPCM difference coding, which can be carried out with any one of seven different prediction modes. Correspondingly, the "Predictor" control parameter can be set to a value between 0 and 7. In Table 4, you will see what algorithm your setting of 1--7 will use, where Pr Px is the predictor, and Ra, Rb, and Rc are the reconstructed samples:

Value JPEG DIS Prediction
0 no prediction
1 Px = Ra
2 Px = Rb
3 Px = Rc
4 Px = Ra + Rb - Rc
5 Px = Ra + ((Rb-Rc)/2)
6 Px = Rb + ((Ra-Rc)/2)
7 Px = (Ra + Rb)/2

JPEG Quality

The baseline JPEG specification calls for a quality setting. The lower the setting, the greater the number of original pixels lost, and therefore the smaller the resulting compressed file will be. ImageGear lets you set the quality of compression with values of type INT between 1-100, where 100 provides the highest retention of original pixel values. A setting of 100 does not mean that the image includes 100% of all original pixel values. With Lossy JPEG, there is no such thing as "no loss". Control parameter for setting Lossy JPEG quality is "Quality".

References Used

Brown, C. Wayne, and Barry J. Shepherd. Graphics File Formats: Reference and Guide. Greenwich, CT.: Manning Publications, 1992.

Kay, David C. and John R. Levine. Graphics File Formats. Windcrest Books, 1992.

Murray, James D. and William vanRyper. Encyclopedia of Graphics File Formats. Sebastopol, CA: O'Reilly & Associates, Inc., 1994.

©2013. Accusoft Corporation. All Rights Reserved.