JPEG Network Graphics File Format JPEG Network Graphics File Format 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 Support
Format TImageFormat equivalent Loading Saving 24 bit RGB ifR8G8B8 YesYes 32 bit ARGB ifA8R8G8B8 YesYes 8 bit grayscale ifGray8 YesYes 16 bit grayscale + alpha ifA8Gray8 YesYes
Lossless JNG alpha channels can have 1, 2, 4, 8, or 16 bit depths but they are converted to 8 bits so that corresponding Imaging data formats for joint color/gray + alpha images can be found. Alpha channels are always saved as 8 bit. 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 Files
OptionId 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:
  • 0 - None Filter
  • 1 - Sub Filter
  • 2 - Up Filter
  • 3 - Average Filter
  • 4 - Paeth Filter
  • 5 - Use 0 for indexed/gray images and 4 for RGB/ARGB images
  • 6 - Adaptive filtering - use best filter for each scanline - very slow
  • Note that filters 3 and 4 are much slower than filters 1 and 2. Default value is 5.
    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).