JNG is a lossy single-image member of the Network Graphics format family. It encapsulates a JPEG datastream in PNG-style chunks, along with an optional alpha channel. While JNG is primarily intended as a subformat of the MNG (Multiple Network Graphics) format, standalone JNG files are also possible.
Alpha channel in JNG images is stored separately from color/gray data and can be lossy (as JPEG image) or lossless (as PNG image) compressed.
JPEG Network Graphics File Format SupportFormat | TImageFormat equivalent | Loading | Saving |
---|---|---|---|
24 bit RGB |
ifR8G8B8
| Yes | Yes |
32 bit ARGB |
ifA8R8G8B8
| Yes | Yes |
8 bit grayscale |
ifGray8
| Yes | Yes |
16 bit grayscale + alpha |
ifA8Gray8
| Yes | Yes |
When working with JNG 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 TJNGFileFormat class.
Options Related to JNG FilesOptionId | Allowed Values | Usage |
---|---|---|
ImagingJNGLossyAlpha | 0 (False) or 1 (True) | Specifies whether alpha channels of JNG images are lossy compressed. Default value is 0. |
ImagingJNGAlphaPreFilter | 0, 1, 2, 3, 4, 5, 6 | Sets precompression filter used when saving lossless alpha channels.
Allowed values are:
|
ImagingJNGAlphaCompressLevel | 0 (no compression) to 9 (best compression) | Sets ZLib compression level used when saving lossless alpha channels. Default value is 5. |
ImagingJNGQuality | 1 to 100 | Defines compression quality used when saving JNG images (and lossy alpha channels). Higher value means worse compression/better image quality/larger file size. Default value is 90. |
ImagingJNGProgressive | 0 (False) or 1 (True) | Specifies whether JNG images are saved in progressive format. 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). |