Filopto by default uses PDF/Jpeg for storing documents and images in the database. However in certain circumstances users are given the option to select the image type to save. The proper selection of image types can significantly affect the storage requirements of the Filopto database. The following chapter describes the various image type and what they mean for image accuracy and storage needs.
Compression Methods
There are basically two types of compression methods: lossy and lossless. Lossy compression creates smaller files by discarding some information about the original image. It removes details and color changes it deems too small for the human eye to differentiate. Lossless compression, on the other hand, never discards any information about the original file.
Following is a advanced discussion of some of the more common formats and their possible use. This discussion is an introduction of the topic of selecting the best image compression for a given use. It is not the intention of this document to recommend a specific compression or image type, but rather introduce the options available. The impact between a compressed and uncompressed image can be measured in the storage space required to store the image and the time required for your computer to display or print it.
Graphic File Formats
The graphic file formats most browsers support are GIF, JPEG and, more recently, Progressive JPEG (p-jpeg). New formats are appearing as possible challengers, including PNG, FIF, and those based on wavelet compression (see below). PNG, being an open standard, promises to replace GIF.
JPEG has no current non-proprietary competition, though there has been a lot of hype, claims and discussion about the various proprietary formats. The potential of improved compression ratios using one of the wavelet flavors is showing scientific promise but will depend on the open standards issue for widespread acceptance.
GIF File Formats
There are two types of GIFs:
• |
GIF87a: supports interlacing and storage of multiple files. It is named after the year it was invented and is the standard. |
• |
GIF89a: extends the GIF87a specification and adds transparency, text comments, and animation of text and graphics. |
While the LZW compression algorithm used by GIFs is one of the better general purpose compression algorithms, it wasn't designed specifically for graphics. It doesn't work well with bi-level (black and white) or true color images.
The LZW algorithm used in GIFs, however, has been patented by Unisys. Developers who distribute applications that create GIFs must obtain a license from Unisys. Soon after CompuServe and Unisys decided to charge royalties for GIFs, PNG was born.
PNG
The Portable Network Graphic (PNG, pronounced ping, format was designed to be a better, legally unencumbered replacement for GIF. Designed to losslessly store a single bitmap image for transmitting over computer networks, PNG matches all of GIFs features except one (multiple images), improves on some (interlacing, compression), and adds new features of its own (gamma storage, full alpha channel, true color support, error detection). Support by Web browsers is mainly through plug-ins, but it should have built-in support by popular browsers within the next year.
Better Compression
PNG uses the Deflate compression method, used in the popular pkzip file archiving utility. Deflate is an improved version of the Lempel-Ziv compression algorithm. It works similarly to the LZW algorithm, and looks for repeated horizontal patterns along each scan line. To further enhance compression, PNG pre filters the image data using predictor functions before it's compressed. PNG uses four predictor functions, two of which address vertical patterns.
So PNG behaves like GIF in that it compresses horizontal patterns, but PNG's filters also find vertical patterns, resulting in additional compression.
Improved Interlacing
PNG uses a 7-pass interlacing scheme which displays a recognizable image much more quickly than an interlaced GIF. While GIFs simply rearrange the order in which rows of pixels are stored, PNG uses the first six passes to gradually build up the even-numbered scan lines (0, 2, 4, etc.) and the final pass to fill in the odd-numbered lines. Users see a 1/64-quality image almost immediately, following by 1/32, 1/16, and so on. The result is a discernible image after only 20 to 30 percent of the image is received, compared to 50 percent for an interlaced GIF. This improved interlacing scheme adds about seven percent to the file's size.
JPEG
JPEG (pronounced jay-peg,) is designed for compressing either full-color or gray-scale images of natural, real-world scenes. JPEG work well on continuous tone images like photographs or natural artwork; not so well on sharp-edged or flat-color art like lettering, simple cartoons, or line drawings. JPEG support 24-bits of color depth or 16.7 million colors (2^24=16,777,216 colors). Progressive JPEG (p-JPEGs) are typically a couple percent smaller than baseline JPEGs; but their main advantage is that they appear in stages, similar to interlaced GIFs.
JPEG is a lossy compression algorithm. JPEG works by converting the spatial image representation into a frequency map. A Discrete Cosine Transform (DCT) separates the high- and low-frequency information present in the image. The high frequency information is then selectively discarded, depending on the quality setting. The greater the compression, the greater the degree of information loss. Compression and decompression times are symmetric, although the International JPEG Group's (IJG) decoder is more optimized and noticeably faster than their encoder. However, when displayed at 8 bits, color quantisation slows decompression considerably. Many commercial vendors of JPEG offer enhancements to speed, color quantisation and quality over the IJG implementation. What separates the various products are the enhancements they offer to the IJG or their own codes:
JPEG Enhancements
• |
Huffman Code Optimization (most offer this feature) - Generates a custom "code table" that works best to compress your individual image instead of using a standard generic code table that works OK for most everything. |
• |
Quantisation Table Optimization (HVS JPEG) |
• |
Improved Sub-sampling (sharper images at the expense of file size) |
• |
Lossless edits/cropping/rotation |
• |
Selective compression - Regions of interest |
JPEG is designed to exploit certain properties of our eyes; namely, that we are more sensitive to slow changes of brightness and color than we are to rapid changes over a short distance. While JPEGs are usually the best choice for photographs, on 8-bit monitors they are force-dithered into an 8-bit palette. JPEG compression takes place in Y/UV space and therefore is treated as 24 bit data (8 bit for grey), regardless of the colors in the original image. Therefore, if you reduce an image from 24bit to 8bit prior to JPEG compression, the compression ratio will worsen as will the overall quality. JPEG compression introduces noise into solid-color areas, which can distort and even blur flat-color graphics. This is why JPEGs are not well suited to flat-color sharp-edged art or type.
JPEG is actually just a compression algorithm, not a file format. The files commonly called JPEG on the Net are really in JFIF (JPEG File Interchange Format). There is work afoot to replace JFIF with a JPEG-based format called SPIFF, but since SPIFF is compatible with JFIF, it's likely that most users won't even notice the changeover. Progressive JPEG is now becoming a widely supported format by browsers and if implemented properly gives the effect of the image fading in as opposed to painting from the top down. P-JPEG may be converted to or from JFIF (standard JPEG) in a completely lossless manner.
JPEG 2000
JPEG 2000 is a new image coding system that uses state-of-the-art compression techniques based on wavelet technology. Its architecture should lend itself to a wide range of uses from portable digital cameras through to advanced pre-press, medical imaging and other key sectors.
JPEG 2000 is the latest series of standards from the JPEG committee. The original standard for digital images (IS 10918-1, popularly referred to as JPEG) was developed 15 years ago, and with the major increase in computer technology since them, and lots of research, it was felt to be time for a new standard capable of handling many more aspects than simply making the digital image files as small as possible. JPEG 2000 uses 'wavelet technology and as well as being better at compressing images (up to 20 per cent plus), it can allow an image to be retained without any distortion or loss. Simply sending the first part of such a 'lossless' file to a receiver can result in a lossy version appearing (like present JPEG) - but continuing to transmit the file results in the fidelity getting better and better until the original image is restored..
TIFF
TIFF is an acronym for Tag(ged) Image File Format. It is one of the most popular and flexible of the current public domain raster file formats. etc.
Limitations: There are no provisions in TIFF for storing vector graphics, text annotation, etc (although such items could be easily constructed using TIFF extensions), and so if this is a requirement you would be better off with a format with broader scope, such as PostScript, CGM, or PICT. TIFF is based on file-offsets, so that it is not easily "streamable" in the way JPEG JFIF streams are.
A common complaint of TIFF is rooted in its flexibility. For example the TIFF format permits both MSB ("Motorola") and LSB ("Intel") byte order data to be stored, with a header item indicating which order is used. There are old, poorly written TIFF programs on the PC which rebelled against this and assume that all TIFF files are Intel byte order. It is very easy to write a TIFF-writer, but very difficult to write a fully TIFF compliant reader.
TIFF uses 4-byte integer file offsets to store image data, with the consequence that a TIFF file cannot have more than 4 Gigabytes of raster data (and some files have begun to approach this boundary). However, this is 4G of compressed data, and so if the compression ratio is high enough, theoretically a TIFF image could be much larger (in fact, 2**32-1 pixels square).
Strengths: TIFF is primarily designed for raster data interchange. It's main strengths are a highly flexible and platform-independent format which is supported by numerous image processing applications. Since it was designed by developers of printers, scanners and monitors, it has a very rich space of information elements for colorimetry calibration, gamut tables, etc. Such information is also very useful for remote sensing and multispectral applications.
Another feature of TIFF which is also useful is the ability to decompose an image by tiles rather than scan lines. This permits much more efficient access to very large imagery which has been compressed (since one does not have to decompress an entire scan line).
Theoretically, TIFF can support imagery with multiple bands (up to 64K bands), arbitrary # bits per pixel, data cubes, and multiple images per file, including thumbnail sub sampled images.
DICOM Images
The introduction of digital medical image sources in the 1970's and the use of computers in processing these images after their acquisition led the American College of Radiology (ACR) and the National Electrical Manufacturers Association (NEMA) to form a joint committee in order to create a standard method for the transmission of medical images and their associated information. This committee, formed in 1983, published in 1985 the ACR-NEMA Standards Publication No. 300-1985. Prior to this, most devices stored images in a proprietary format and transferred files of these proprietary formats over a network or on removable media in order to perform image communication. While the initial versions of the ACR-NEMA effort (version 2.0 was published in 1988) created standardized terminology, an information structure, and unsanctioned file encoding, most of the promise of a standard method of communicating digital image information was not realized until the release of version 3.0 of the Standard in 1993. The release of version 3.0 saw a name change, to Digital Imaging and Communications in Medicine (DICOM), and numerous enhancements that delivered on the promise of standardized communications.
Rather then develop medical-image-specific compression schemes, DICOM adopts standards developed by ISO/IEC JTC 1/SC 29/WG 1 such as JPEG and JPEG 2000. For interchange media, standard file systems compatible with conventional software (such as ISO 9660 and UDF) are used.
Therefore DICOM is a standard developed by the American College of Radiology Manufacturers Association to define the connectivity and communication protocols of medical imaging devices it is not an image type. Digital Imaging and Communications in Medicine (DICOM) is a comprehensive set of standards for handling, storing and transmitting information in medical imaging. It includes a file format definition and a network communication protocol.