JPEG (Joint Photographic Experts Group) format is good choice for storing images with large number of colors and without sharp edges. It uses lossy compression which can greatly reduce size of image file. Imaging uses Independent JPEG Group's jpeglib library to load and save JPEG files. It was translated to Pascal by Jacques Nomssi Nzali. As stated in jpeglib's documentation this library can read and write JFIF format which is most widely used JPEG format. But there are also some proprietary and other JPEG formats which can not be read/written by jpeglib thus Imaging can not read/write them also.
JPEG File Format SupportFormat | TImageFormat equivalent | Loading | Saving |
---|---|---|---|
24 bit RGB |
ifR8G8B8
| Yes | Yes |
8 bit grayscale |
ifGray8
| Yes | Yes |
When working with JPEG files you can find useful some options which can be set by SetOption function and their current values can be get by GetOption function. Or you can set them by modifying properties of TJpegFileFormat class.
Options Related to JPEG FilesOptionId | Allowed Values | Usage |
---|---|---|
ImagingJpegQuality | 1 to 100 | JPEG compression quality used when saving images. Higher value means worse compression/better image quality/larger file size. Default value is 90. |
ImagingJpegProgressive | 0 (False) or 1 (True) | Indicates whether JPEG is saved as progressive or not. Progressive JPEG rearranges the stored data into a series of scans of increasing quality. In situations where a JPEG file is transmitted across a slow communications link, a decoder can generate a low-quality image very quickly from the first scan, then gradually improve the displayed quality as more scans are received. Default value is 0 (False). |