Lossy Compression Degrades Data
Avoid the use of lossy compression.
- Image file compression comes in two basic types.
- Loss-less file compression reduces the size of the image file while maintaining the integrity of the image data. An example of loss-less file compression is the compressed Tiff file format, which uses the LZW algorithm. This type of file compression is appropriate for scientific data, although compressed Tiff files are not universally supported by imaging software.
- The most common form of lossy file compression is that provided by the Jpeg file format. Jpeg is an ISO/ITU standard file format for storing images that uses the discrete cosine transform (a complex mathematical algorithm) to compress the file. The Jpeg file format is not suitable for scientific images because of the changes that the transform makes to the image data. The discrete cosine transform changes the spatial (XY) resolution of the image and the intensity value of any given pixel.
- The Joint Photographic Expert Group (JPEG) says that “many aspects of scientific and industrial usage involve subsequent processing of a digital image, for example to enhance features or count items. Using any form of lossy compression for images in this context may create problems - after all the information thrown away during lossy compression is generally that information that is imperceptible to a human eye - not necessarily showing the same characteristics as computer image processing software”.
- Dr. John Russ adds; “The reason for recording images in scientific studies is not to keep remembrances of familiar objects and scenes, but to record the unfamiliar. If it is not possible to know beforehand what details may turn out to be important, it is not wise to discard them. And if measurement of features is contemplated (to measure size, shape, position or color information), then lossy compression, which alters all of those values, must be avoided”.
- The Journal of Cell Biology simply states; “It is tempting to acquire your image files in JPEG format to save disk space, but doing so compromises your data. Always use TIF format”.
- TIFF is the only file format that is recommended for scientific images by the Microscopy Society of America. TIFF is a loss-less file format that supports a wide range of bit-depths.
- An excellent tutorial demonstrating the issues with using Jpeg for scientific images is available at Florida State University’s Molecular Expressions website. See: http://micro.magnet.fsu.edu/primer/java/digitalimaging/processing/jpegcompression/
- Other well known image file formats (additional information and links available at: http://en.wikipedia.org/wiki/Image_file_formats )
- GIF image files are limited to 256 colors or shades of grey. Saving images with higher bit-depths to this file format will result in a loss of information.
- PNG image files use loss-less compression and can store bit depths of up to 48bit color or 16bit greyscale.
- PSD image files are native Adobe Photoshop files. These support high resolutions and bit depths, but are uncompressed files.
- RAW image files can support high resolutions and bit depths, but are uncompressed files. This is not a fully standardized file format yet.
- If you must use the JPEG file format — for example, to post an image on a web site — save the image into the JPEG file format as the final step and not before.
- With most image manipulation programs, opening and saving a JPEG image multiple times applies the compression algorithm to the image repeatedly. This degrades the image each time it is re-saved.
- Users should be aware that other computer programs use lossy compression.
- The Adobe Acrobat program is often configured by default to apply Jpeg compression to images embedded in documents that are being transformed into PDF files.
- Microsoft Powerpoint is used by some labs to lay out figures for publication. Powerpoint is undoubtedly simpler to use than most bitmap manipulation programs (e.g., Adobe Photoshop, Corel Photo-Paint, ImageJ); however, resizing images in this program can cause the loss of data (see guideline #12) and compressing the PPT file is believed to apply Jpeg compression to the embedded images.
- Powerpoint is designed to prepare presentations at screen resolutions (72 dpi), rather than print (typically 300 dpi for images, 1200 dpi for text and line art).
- Powerpoint is not the best tool for assembling figures for print, and many journals will not accept files in the PPT format.
|