Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
999 views

Image File Formats

Image file formats provide a standardized method of organizing and storing image data. Image compression is a method of using algorithms to decrease file size. Lossless compression algorithms reduce file size with no loss in image quality.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
999 views

Image File Formats

Image file formats provide a standardized method of organizing and storing image data. Image compression is a method of using algorithms to decrease file size. Lossless compression algorithms reduce file size with no loss in image quality.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Computer Graphics Course

Image file formats


Image file formats provide a standardized method of organizing and storing image data. This article deals with digital image formats used to store photographic and other image information. Image files are made up of either pixel or vector (geometric) data, which is rasterized to pixels in the display process, with a few exceptions in vector graphic display. The pixels that comprise an image are in the form of a grid of columns and rows. Each of the pixels in an image stores digital numbers representing brightness and color.

Image file sizes


Image file sizes, expressed in bytes, increase with the number of pixels in the image, and the color depth of the pixels. The more rows and columns, the greater the image resolution and the greater the file size. Also, each pixel making up the image increases in size as color depth is increased. An 8-bit pixel (1 byte) can store 256 colors and a 24-bit pixel (3 bytes) can store 16 million colors. The latter is known as truecolor. Image compression is a method of using algorithms to decrease file size. High resolution cameras lead to large image files. Files sizes may range from hundreds of kilobytes to many megabytes depending on the cameras resolution and the format used to save the images. High resolution digital cameras record 8 megapixels (MP) (1MP= 1000000 pixels/ 1 million) images, or more, in truecolor. Consider an image taken by an 8 MP camera. Since each of the pixels uses 3 bytes to record true color, the uncompressed image would occupy 24,000,000 bytes of memory. That is a lot of storage space for just one image, and cameras must store many images to be practical. Faced with large file sizes, both within the camera, and later on disc, image file formats have been developed to address the storage problem. An overview of the major graphic file formats is given below.

Image file compression


There are two types of image file compression algorithms: lossy and lossless.

Lossless compression
Lossless compression algorithms reduce file size with no loss in image quality, although compression ratios are generally weak. Most images destined for print, or when image quality is valued above file size, are compressed using lossless algorithms.

[Dr. Mohammed Fadle]

Computer Graphics Course

Lossy compression
Lossy compression algorithms take advantage of the inherent limitations of the human eye and discard information that cannot be seen. Most lossy compression algorithms allow for variable levels of quality (compression) and as these levels are decreased, file size is also reduced. At the highest compression levels, image deterioration becomes noticeable. This deterioration is known as compression artifacting. The images linked below demonstrate the noticeable artifacting associated with lossy compression algorithms. Click on the thumbnail image to view the full size version.

Exif
The Exif (Exchangeable image file) format is an algorithm incorporated in the JPEG software used in most cameras. Its purpose is to record and to standardize the exchange of data between digital cameras and editing and viewing software. The data are recorded for individual images and includes such things as: camera settings, time and date, shutter speed, exposure, image size, compression, name of camera, color information, etc. When images are viewed or edited by image editors, such as Paint Shop Pro, all of this image information can be displayed.

Major graphic file formats


There are many graphic file formats, if we include the proprietary types. The PNG, JPEG, and GIF formats are most often used to display images on the Internet. These graphic formats are listed and briefly described below, separated into the two main families of graphics: raster and vector.

Raster formats
JPEG

The JPEG (Joint Photographic Experts Group) image files are a lossy format. The DOS filename extension is JPG, although other operating systems may use JPEG. Nearly all digital cameras have the option to save images in JPEG format. The JPEG format supports 8-bit per color - red, green, and blue, for 24-bit total and produces relatively small file sizes. Fortunately, the compression in most cases does not detract noticeably from the image. But JPEG files do suffer generational degradation when repeatedly edited and saved. Photographic images are best stored in a lossless non-JPEG format if they will be re-edited in future, or if the presence of small "artifacts" (blemishes), due to the nature of the JPEG compression
2 [Dr. Mohammed Fadle]

Computer Graphics Course

algorithm, is unacceptable. JPEG is also used as the image compression algorithm in many Adobe PDF files.
TIFF

The TIFF (Tagged Image File Format) is a flexible image format that normally saves 16-bit per color - red, green and blue for a total of 48-bits - or 8-bit per color - red, green and blue for a total of 24-bits - and uses a filename extension of TIFF or TIF. TIFF's flexibility is both a feature and a curse, with no single reader capable of handling all the different varieties of TIFF files. TIFF can be lossy or lossless. Some types of TIFF offer relatively good lossless compression for bi-level (black and white, no grey) images. Some high-end digital cameras have the option to save images in the TIFF format, using the LZW compression algorithm for lossless storage. The TIFF image format is not widely supported by web browsers, and should not be used on the World Wide Web. TIFF is still widely accepted as a photograph file standard in the printing industry. TIFF is capable of handling device-specific color spaces, such as the CMYK defined by a particular set of printing press inks.
RAW

The RAW image format is a file option available on some digital cameras. It usually uses a lossless compression and produces file sizes much smaller than the TIFF format. Unfortunately, the RAW format is not standard among all camera manufacturers and some graphic programs and image editors may not accept the RAW format. The better graphic editors can read some manufacturer's RAW formats, and some (mostly higher-end) digital cameras also support saving images in the TIFF format directly. Adobe's Digital Negative Specification is a recent (September 2004) attempt at standardizing the various "raw" file formats used by digital cameras.
PNG

The PNG (Portable Network Graphics) file format is regarded and was made as the free and open-source successor to the GIF file format. The PNG file format supports true color (16 million colors) whereas the GIF file format only allows 256 colors. PNG excels when the image has large areas of uniform color. The lossless PNG format is best suited for editing pictures, and the lossy formats like JPG are best for final distribution of photographic-type images because of smaller file size. Many older browsers do not yet support the PNG file format, however with the release of Internet Explorer 7 all popular modern browsers fully support PNG. The Adam7-interlacing allows an early preview even when only a small percentage of the data of the image has been transmitted.
GIF

[Dr. Mohammed Fadle]

Computer Graphics Course

GIF (Graphic Interchange Format) is limited to an 8-bit palette, or 256 colors. This makes the GIF format suitable for storing graphics with relatively few colors such as simple diagrams, shapes and cartoon style images. The GIF format supports animation and is still widely used to provide image animation effects. It also uses a lossless compression that is more effective when large areas have a single color, and ineffective for detailed images or dithered images.
BMP

The BMP (bit mapped) format is used internally in the Microsoft Windows operating system to handle graphics images. These files are typically not compressed resulting in large files. The main advantage of BMP files is their wide acceptance, simplicity, and use in Windows programs. However, they may pose problems for users of other operating systems. Commonly, BMP files are used for Microsoft's Paint program. Since most BMP files are uncompressed, and BMP's RLE compression has serious limits, the large size of BMP files makes them unsuitable for file transfer. However, Bit Map images are suitable for background images and wallpapers. This is especially true for screen shots. In addition, images from scanners are usually stored in BMP files.
WDP

The WDP format is the newly introduced image format by Microsoft for media print quality, lossless image compression. This image standard has a specific applicability to mostly print media due to its size although it is rumored to be the standard for Microsoft Office 2007 and the upcoming Windows Vista operating system. This format is very similar to the TIFF format, but can handle a much larger range of image types and qualities such as 8, 16, and 32 bits per channel processing, N-Channel support, and embedded tiling.
XPM

The XPM format is the default X Window System picture format (very popular in the Linux world). Its structure is based on the string format of the C programming language. Because XPM was designed to be human-readable, and is stored as uncompressed plain-text, the file size of these pictures can be more than twice as large as uncompressed binary bitmap files (such as BMP, uncompressed TIFF, MacOS-PICT, or Irix-RGB formats). This format is unsupported by most non-Unix software and operating systems (though many web-browsers retain display support for the XBM subset, which was the minimal image format in the early days of the WWW).
MrSID

The MrSID (Multiresolution Seamless Image Database) format is a wavelet compression format used mostly by Geographic Information Systems to store massive satellite imagery for map software.
4 [Dr. Mohammed Fadle]

Computer Graphics Course

Vector formats
As opposed to the raster image formats above (where the data describes the characteristics of each individual pixel), vector image formats contain a geometric description which can be rendered smoothly at any desired display size. Vector file formats can contain bitmap data as well. 3D graphic file formats are technically vector formats with pixel data texture mapping on the surface of a vector virtual object, warped to match the angle of the viewing perspective. At some point, all vector graphics must be rasterized in order to be displayed on digital monitors. However vector images can be displayed with analog CRT technology such as that used in some electronic test equipment, medical monitors, radar displays, laser shows and early video games. Plotters are printers that use vector data rather than pixel data to draw graphics.
SVG

SVG (Scalable Vector Graphics) is an open standard created and developed by the World Wide Web Consortium to address the need (and attempts of several corporations) for a versatile, scriptable and all-purpose vector format for the web and otherwise. The SVG format does not have a compression scheme of its own, but due to the textual nature of XML, an SVG graphic can be compressed using a program such as gzip. Because of its scripting potential, SVG is a key component in web applications: interactive web pages that look and act like applications.

[Dr. Mohammed Fadle]

Computer Graphics Course

Tagged Image File Format


Tagged Image File Format (TIFF) is a file format for mainly storing images, including photographs and line art. Originally created by the company Aldus, jointly with Microsoft, for use with PostScript printing, TIFF is a popular format for high color depth images, along with JPEG and PNG. TIFF format is widely supported by image-manipulation applications such as Photoshop by Adobe, GIMP, Ulead PhotoImpact, and Photo-Paint as well as Paint Shop Pro by Corel, by desktop publishing and page layout applications, such as QuarkXPress and Adobe InDesign, and by scanning, faxing, word processing, optical character recognition, and other applications.

History
The phrase "Tagged Image File Format", or, actually, "Tag Image File Format", was used as a subtitle in some earlier versions of the TIFF specification. The current TIFF specification, TIFF 6.0, makes no mention of these phrases; the name is now, simply, "TIFF". TIFF was originally created as an attempt to get desktop scanner vendors of the mid-1980's to agree on a common scanned image file format, rather than have each company promulgate its own proprietary format. In the beginning, TIFF was only a bi-level image format, since that was all that desktop scanners could handle. As scanners became more powerful, and as desktop computer disk space became more plentiful, TIFF grew to accommodate grayscale images, then color images.

Flexible options
TIFF is a flexible and adaptable file format. It can handle multiple images and data in a single file through the inclusion of "tags" in the file header. Tags can indicate the basic geometry of the image, such as its size, or define how the image data is arranged and whether various image compression options are used. For example, TIFF can be used as a container for JPEG and RLE (run-length encoding) compressed images. A TIFF file can also include a vector-based clipping path (an outline that crops or frames the main image). The ability to store image data in a lossless format makes TIFF files a useful method for archiving images. Unlike standard JPEG, TIFF files can be edited and resaved without suffering a compression loss. Other TIFF file options include multiple layers or pages. Although it is a widely accepted standard format today, when TIFF was first introduced, its extensibility led to compatibility problems. Programmers were free to specify new tags and options, but not all programs implemented support for all the tags that had been created. As a result the lowest common denominator soon became "the" TIFF, and even today the vast majority of TIFF files, and the code that reads them, are based on a simple 32-bit uncompressed image. TIFF does have an option to use LZW compression, a lossless data compression technique for reducing file size. Until recently, however, the use of this option was limited because the LZW technique was the subject of several patents in various jurisdictions. The most well-known and controversial of these, US patent number 4,558,302 owned by Unisys, expired on June 20,
6 [Dr. Mohammed Fadle]

Computer Graphics Course

2003; the last outstanding patent, owned by IBM, which had shown no interest in enforcing it, expired on August 11, 2006. Every TIFF file begins with a 2-byte indicator of byte order: "II" for little endian and "MM" for big endian byte ordering. The following 2 bytes represent the number 42. The number 42 was selected "for its deep philosophical significance." The reading of 42 is dependent on the byte order indicated in the first 2 bytes. The entire file is read based on the indicated byte order. Byte order can cause compatibility issues between Apple Macintosh and Windows programs, which typically use different byte order for TIFF files. Some programs offer the option of saving in Mac or Windows byte order so files can be used across platforms.

TIFF in document imaging


TIFF format is standard in document imaging and document management systems. In this environment it is normally used with CCITT Group IV 2D compression, which supports blackand-white (also called bitonal or monochrome) images. In high-volume environments, documents are typically scanned in black and white (rather than color or grayscale) to conserve storage capacity. An average A4 scan produces 30 kilobytes (KB) of data at 200 ppi (pixels per inch resolution) and 50 KB of data at 300 ppi. 300 ppi is far more common than 200 ppi. Because TIFF format supports multiple pages, multi-page documents can be saved as single TIFF files rather than as a series of files for each scanned page.

Exploits
The TIFF file format is unusual in comparison to other image formats, in that it is composed of small descriptor blocks containing offsets into the file which point to the actual pixel image data (composed of bands of pixel rows). This means that incorrect offset values can cause programs to attempt to read erroneous portions of the file or attempt to read past the physical end of file. Like most other image file formats, improperly encoded packet or line lengths within the file can cause poorly written rendering programs to overflow their internal buffers. Properly written image rendering programs generally avoid such pitfalls. Multiple buffer overflows have been found in libtiff[1][2][3], some of these have also been used to execute unsigned code on the PlayStation Portable[4][5].

Windows Picture and Fax Viewer is an image viewer. It is a part of the Windows XP and Windows Server 2003 operating systems. It is capable of viewing JPG, BMP, PNG, GIF, WMF, EMF and TIFF format files.

General :

Apart from its rudimentary image rotating tool, and its TIFF annotation feature, the Windows Picture and Fax Viewer only views, and does not edit images. It is a colourmanaged application which recognizes embedded ICC colour profiles in JPG and TIFF files.

[Dr. Mohammed Fadle]

Computer Graphics Course

Windows XP contains other programs that are capable of image editing, such as Microsoft Paint.

Special handling of TIFF files


If a TIFF formatted file is opened in Windows Picture and Fax Viewer, a new toolbar will appear at the bottom of the screen. This toolbar has icons that allow other operations to be performed. Lines can be drawn on the image and text added to it. Areas of the image can be selected and concealed.

Criticism : The viewer is known to not render PNG images correctly at times. Even at a
100% zoom level, it sometimes causes entire lines to not be rendered, which can be very confusing when examining critical image data. A buffer overflow vulnerability has been found in the underlying graphics rendering engine, which could allow an attacker to execute code remotely by getting the user to view a specially crafted WMF file. Microsoft released a patch for this vulnerability in January 2006; their bulletin also states that a valid workaround is to disable the viewer via the registry. See Windows Metafile vulnerability. The viewer is the default viewer for many file types in Windows XP, but it can easily be replaced as the default by another viewer/editor that a user has installed on the system by rightclicking on a file of the chosen file type and selecting the "Choose Program" menu item.

Windows Vista :

The picture viewer in Windows Vista, renamed Windows Photo Gallery Viewer, is completely rewritten and is based on Windows Photo Gallery which uses the Windows Imaging Component (WIC). Since the Windows Imaging Component is extensible, Windows Photo Gallery and Windows Photo Gallery Viewer can export and view any image format for which a third party codec is installed. By default, the Windows Photo Gallery Viewer can view JPEG, BMP, PNG, GIF, TIFF and Windows Media Photo images, as well as video. It even supports lossless rotation of images. However, legacy image formats such as WMF and EMF do not have their respective codecs installed in WIC, and therefore cannot be viewed by default.

[Dr. Mohammed Fadle]

Computer Graphics Course

Producing Images for the World Wide Web

Introduction
Current computer technology offers tremendous power for capturing, creating, and editing images electronically. With a grounding in the fundamentals of electronic graphic design, it is simple to create high-quality electronic images using ordinary off-the-shelf scanning and image-editing software. This Network Notes discusses the core principles of electronic image preparation for computer display and transmission over the WWW. It covers the impact of viewing technology, storage and delivery media on image design, as well as the differences between image file formats for WWW viewing and editing. Procedural recommendations for producing electronic images for the World Wide Web are also provided.

Differences of View
In order to produce high-quality electronic images, it is essential to understand the characteristics and capabilities of the viewing technology. Electronic images can be displayed in two different ways: 1. printed to hard copy 2. viewed on a computer monitor The difference between these two media has a significant bearing upon the design of the electronic image. Effective image preparation for print must account for the physical properties of the paper, inks and printer, such as:

absorbency of the paper viscosity of the ink and its bleeding or wicking behaviour colour-matching the computer monitors display with the printer inks printer resolution (i.e., the degree of detail that the printer can produce) printer colour depth (i.e., the range of colours and inks available) paper size printer memory size (i.e., the amount of data that the printer is able to process)

Just as the preparation of electronic images for print must account for the attributes of the paper, inks and printer, images designed for computer display must address the capabilities of the monitor. Aspects of the monitor, which have direct impact on image design, are:

colour depth (i.e., the range of colours that can be displayed) size of the viewing area screen resolution (i.e., the fineness of detail that the monitor can display) video memory (i.e., the speed with which the monitor can draw the image)

[Dr. Mohammed Fadle]

Computer Graphics Course

Basic Computer Configuration for WWW Images


A major challenge of publishing on the WWW is to create documents that are both well-designed and accessible to the broadest technological base possible. This means developing documents that appeal not only to users inside large organizations with state-of-the-art browsers and fast, networked Internet connections, but also to those with older, less-capable browsers and slower dial-up modem connections. With this in mind, WWW authors generally design for a basic computer configuration that has:

an Internet connection at 9600 BPS or greater a 1-MB video card displaying 8-bit colour depth (maximum 256 colours) a 14-inch colour SVGA monitor a screen resolution at 640 480 pixels, and 72 pixels per inch (PPI)

Image Quality vs. File Size


Transmission and delivery of electronic images In addition to the capabilities of the viewing technology, electronic image design must also consider the limitations of the delivery medium. Since CD-ROM technology offers fast data transmission speeds and large storage capacity, it is well suited for storing large electronic images. In contrast, the slow transmission speeds of computer networks and distributed, global information systems such as the WWW, make it especially important to minimize the file size of graphics. File sizes may be reduced in a number of ways, but as file size decreases, image quality deteriorates. This is because file size is determined by the breadth of information contained within the image, such as the number of unique colours, the fineness of detail, image dimensions. Removing any information will reduce file size but will also affect the appearance of the image. The goal of preparing images for the WWW, therefore, is to achieve a compromise between acceptable image quality and optimal file size. This is all the more difficult because an acceptable compromise is entirely subjective and cannot be quantified. In other words, although image preparation for the WWW requires objective, technical precision such as adjusting colour depth to reduce file size, this activity is ultimately governed by the ambiguous and immeasurable opinion of the eye of the beholder to define the boundaries of acceptable image quality. Techniques for reducing file size The file size of electronic images is determined by five attributes: 1. 2. 3. 4. 5.
10

file format colour depth resolution editing effects image size


[Dr. Mohammed Fadle]

Computer Graphics Course

The file format is nothing more than a software algorithm for encoding the image data, including the other four attributes, along with compression instructions on how to pack and unpack the entire image. Hundreds of different graphic file formats exist, but only a few are essential in preparing images for the WWW.

Different File Formats for Different Purposes


WWW image-viewing file formats (GIF, JPEG, etc.) The World Wide Web officially supports only one inline graphics file format: GIF (Graphics Image Format). This means images stored in the GIF file format can be embedded within documents and viewed alongside text through browsers with a graphical user interface (GUI). The GIF format uses a compression technique that is good for images with large blocks of similar colours, such as icons or drawings, but is restricted to a colour depth of 256 unique hues. Because of this limitation, another file format called JPEG, after its creators the Joint Photographic Experts Group, is commonly used on the WWW. The JPEG format supports a colour depth of up to 16 777 216 different hues and has better compression for images with fine detail and broad colour variance than the GIF format. For this reason, the JPEG format is excellent for photos. These two viewing formats are the current de facto file format standards for images on the WWW: 1. GIF, used mainly for icons, toolbars, and inline images 2. JPEG, used for separately-linked, and usually larger, detailed photographs Although still not part of the official HTML standard, some of the leading browsers, such as Netscape Corp.s Navigator and Microsoft Inc.s Internet Explorer, can now view JPEG files inline (i.e., embedded in documents) just as they do with GIF files. Similarly, some browsers are now able to display GIF and JPEG images as tiled backgrounds. Even though JPEG- format inline images are appearing with greater frequency on the WWW, this practice is currently discouraged because many browsers still cannot view inline JPEG files. In contrast, it is acceptable to use JPEG instead of GIF files for background images because, (a) the background image provides design enhancement, not meaningful content; and (b) the background image tag is a Netscape extension of the HTML specification, and, therefore, unreadable to many browsers in the first place. (Browsers that do not support the Netscape extensions will ignore the background image tag even if it references a GIF or JPEG file.) However, since all browsers with a graphical user interface can view inline images, it is important to use the HTML standard inline image format, GIF, until an official amendment approving the JPEG format is produced. Image-editing file formats (TIFF, etc.) Both of the WWWs de facto file formats for images have critical limitations: GIF has a maximum colour depth of 256 colours; JPEG has a compression algorithm that discards some of the original images information. The loss of information is usually undetectable by the naked eye, but further editing of this JPEG image usually
11 [Dr. Mohammed Fadle]

Computer Graphics Course

magnifies the distortions. In either case, GIF and JPEG are poorly suited for editing electronic images. They should be used exclusively as viewing formats. In practice, electronic images should be saved in these formats only after they are edited for optimum appearance and file size. Furthermore, once an image is saved in either GIF or JPEG format, it should not be re- edited. For editing purposes, electronic images should be saved in a file format that has both the colour depth of JPEG (i.e., able to contain millions of different colour hues), and the compression accuracy of GIF (in which the saved copy is identical to the original without any loss of information). Many file formats satisfy these criteria and are adequate for the task, but TIFF (tagged-image file format), created by Aldus Corp., is worth mentioning because it is widely-supported by many different image-editing and scanning software for PC, Mac, and UNIX-based operating systems. Colour and compression: considerations For GIF files, the colour depth must be reduced to an indexed colour table of 8 bits (2 to the power of 8, or 256 colours) or less (i.e., 7 bits or 128 colours, 6 bits or 64 colours, 5 bits or 32 colours, 4 bits or 16 colours, 3 bits or 8 colours). The indexed table is determined by the dominant colours in the image. Colours in the original image are ranked according to frequency and their similarity to other shades so that those which appear frequently are short-listed to the indexed table and substituted for similar shades. This means a shade of red that appears in thousands of pixels in the original will be included in the indexed colour table. For JPEG files, the original colour depth is preserved but the level of compression must be set to either:

maximum compression, which produces the smallest file size but poorer image quality moderate compression; the lowest level which produces the largest file size but the best quality image

If the converted GIF or JPEG images require additional editing, the proper procedure is to reopen the reference TIFF file, make all adjustments, and save a new copy in GIF or JPEG format. The reason for manipulating the original TIFF rather than the viewing-format images is that GIF and JPEG files are abstractions of the original TIFF image file. Hence, subsequent edits of GIF or JPEG files produce abstractions of abstractions, leading towards visible distortions and poor image quality. Therefore, it is best to edit with the fullest field of information available, so that the best image quality and truest representation of the original is preserved. Four Basic Steps to Producing Electronic Images for the WWW 1. The first step is to prepare the electronic image for the WWW using one of the following methods: o capture the original with a scanner or video input device, or o import an electronic image from another source, or o create an image by using a drawing/painting program 2. The second step is to save the image as a reference TIFF file (i.e., as an original) with as much information as storage capacity permits. The image
12 [Dr. Mohammed Fadle]

Computer Graphics Course

should have a rich colour-depth, high resolution, and relatively large image dimensions. 3. The third step is to edit the image by adjusting its appearance with special filters, and reduce its file size by altering the colour depth, resolution, and image dimensions. 4. The final step is to save the edited image as a GIF or JPEG, or other appropriate viewing file format for the World Wide Web. The editing process can be compared to carving a sculpture from wood whereby the original is whittled and stripped apart until a smaller, detailed and polished object is produced. The danger is that information once stripped away is difficult to replace. Simulation and repair techniques to recover the removed information are available, but they are extremely time-consuming, frustrating, and usually imprecise with unsatisfactory results. It is preferable to save multiple versions of the original throughout the editing process using a controlled naming convention (e.g., image1a.tif, image1b.tif, image1c.tif, etc.), so that mistakes can be easily eradicated.

Brief Glossary of Electronic Imaging Terms


Brightness -- the intensity of the shades in an image. Contrast -- the range of shades in an image. Drawing -- an image type that uses large blocks of single colours or gray shades rather than small, individual dots. File Format -- the software format an image is digitally stored. Common image formats are GIF, JPG, TIFF and BMP. File Size -- the total number of bytes in an image. Size is determined by file format, colour depth, image size, resolution, and editing effects (such as sharpening). Halftone -- an image type that simulates gray scales by using various-sized dots, as commonly used in black-and-white newspaper photos. HSB -- The Hue, Saturation, and Brightness balance of an image. Hue -- the value of a colour; or the sum of a colours saturation and brightness. Image Size -- the height and width of an image, measured in pixels. Image type -- the visual format of a scanned image, not to be confused with the file format. Three main classes of image type are photo, halftone and drawing. Indexed Colour Table -- the reduction of an image into a grid containing a set number of colours. VGA and EGA monitors can read only 16-colour indexed colour tables, whereas SVGA monitors can support up to 256-colour indexed colour tables. The most commonly used file format on the WWW that uses an indexed colour table is GIF (256 colours). An indexed 256-colour table is also referred to as 8-bit colour.
13 [Dr. Mohammed Fadle]

Computer Graphics Course

Millions of Colours (a.k.a. True Colour) -- 24-bit colour that allows up to 16.7 million different colours in an image. Currently, most computer users do not have monitors capable of viewing this colour depth. Optical Character Recognition (OCR) -- Software that translates images of words into ASCII characters. Photo or Photograph -- an image type with high definition, including many different shades of gray or colour. Resolution -- the concentration of dots per inch (dpi) in an image. SVGA monitors are typically 72 dpi. Saturation -- the depth or intensity of a colour. Increasing colour saturation makes the colours appear richer, decreasing saturation makes them paler. Sharpness -- an image-editing technique that accentuates the relief between shades, decreases blurring, and makes the image appear more defined. Also increases the file size. TWAIN -- the industry standard for exchanging information between graphics applications (such as desktop publishing software) and peripheral devices (such as scanners or other image-capturing devices).


14

Grapgic Formats AVI File (*.avi) MPEG File (*.mpg, *.mpeg) BMP Image File (*.bmp) Kodak Cineon (*.cin) Combustion* by Discreet (*.cws) GIF Image File (*.gif) Radiance Image File (HDRI) (*.hdr, *.pic) IFL Image File (*.ifl) JPEG File (*.jpg, *.jpe, *.jpeg) OpenEXR Image File (*.exr) PNG Image File (*.png) Adobe PSD (*.psd) Apple QuickTime File (*.mov) SGI's Image File Format (*.rgb, *.sgi) RLA Image File (*.rla) RPF Image File (*.rpf) Targe Image File (*.tga, *.vda, *.icb, *.vst) TIFF Image File (*.tif) YUV Image File (*.yuv) DDS Image File (*.dds) Encapsulated PostScript File (*.eps, *.ps) 3D Studio (.3DS) 3D Studio Shape (*.SHP)
[Dr. Mohammed Fadle]

Computer Graphics Course

Adobe Illustrator (*.AI) ASCII Scene Export (*.ASE) Lightscape - Material (*.ATR), Blocks (*.BLK), Parameter (*.DF), Layers (*.LAY), Preparation (*.LP), View (*.VW) JSR-184 (*.M3G) Shockwave 3D (*.W3D) LandXML / DEM / DDF (*.XML, *DEM, *.DDF) Autocad Drawing (*.DWG, *.DXF) Legacy Autocad (*.DWG) Autodesk FBX (*.FBX, *.DAE) Autodesk Inventor (*.IPT, *.IAM) Motion Analysis HTR File (*.HTR) TRC File (*.TRC) IGES (*IGE,*.IGS,*.IGES) Lightscape (*.LS, *.LP, *.VW) Wavefront Object (*.OBJ) and Material (*.MTL) StereoLitho (*.STL) VRML (*.WRL, *WRZ) VIZ Material XML (*.XML) JPEG Header Format Size 2 2 2 1 1 1 1 description
JPEG SOI marker (FFD8 hex) image width in pixels image height in pixels number of components (1 = grayscale, 3 = RGB) horizontal/vertical sampling factors for component 1 sampling factors for component 2 (if RGB) sampling factors for component 3 (if RGB)

Jpeg use jpeg compression ,lossy compression. In 8-bit monitors they are forcedithered into an 8-bit palette . JPEG Compression Description Format Ratios 10:1 - 20:1 High quality - has little or no loss in image quality. (High) Worse results for flat color and sharp-edge art. 30:1 - 50:1 (Medium) 60:1 - 100:1 (Low) Moderate quality - usually the best choice for the Web Poor quality - suitable for thumbnails and previews. Visible blockiness (pixelation). BMP (Windows) Header Format
15 [Dr. Mohammed Fadle]

Computer Graphics Course

Size Description signature, must be 4D42 hex 2 size of BMP file in bytes (unreliable) 4 reserved, must be zero 2 reserved, must be zero 2 offset to start of image data in bytes 4 size of BITMAPINFOHEADER structure, must be 40 4 image width in pixels 4 image height in pixels 4 number of planes in the image, must be 1 2 number of bits per pixel (1, 4, 8, or 24) 2 compression type (0=none, 1=RLE-8, 2=RLE-4) 4 size of image data in bytes (including padding) 4 horizontal resolution in pixels per meter (unreliable) 4 vertical resolution in pixels per meter (unreliable) 4 number of colors in image, or zero 4 number of important colors, or zero 4 GIF Image Format GIF use lossless compression type called LZW compression; GIF files contain no dpi information for printing purposes. GIFs are 8-bit images, which limits them to a maximum of only 256 colors. GIF is indexed color that means for GIF files, a 24 bit RGB image requires conversion to indexed color. More specifically, this means conversion to 256 colors, or less. Indexed Color can only have 256 colors maximum. GIFs generally appear sharper than JPEGs. AVI Header Format Size 4 4 4 4 4 4 4 4 4 4 4 4 8
16

Description time delay between frames in microseconds data rate of AVI data padding multiple size, typically 2048 parameter flags number of video frames number of preview frames number of data streams (1 or 2) suggested playback buffer size in bytes width of video image in pixels height of video image in pixels time scale, typically 30 data rate (frame rate = data rate / time scale) starting time, typically 0
[Dr. Mohammed Fadle]

Computer Graphics Course

By Using Format Factory This is a software used to convert from one format to another for images , videos or audios. Advanced > Media File Info

Convert an Image

JPEG IMAGE

1. Convert a JPEG to BMP. 2. Convert a JPEG to GIF. 3. Convert a GIF and BMP to JPEG. This image is a JPEG image that has the following header information. Format : JPEG File size : 71.5 KiB Image Format : JPEG Width : 470 pixels Height : 488 pixels Resolution : 8 bits Horizontal resolution : 72 dbi Vertical re resolution: 72 dbi Bit depth: 24 Frame count: 1

1. Convert a JPEG to BMP This is the BMP image that has the following header information: Format : Bitmap File size : 673 KiB
17 [Dr. Mohammed Fadle]

Computer Graphics Course

Image Format : Bitmap Width : 470 pixels Height : 488 pixels Horizontal resolution : 72 dbi Vertical re resolution: 72 dbi Bit depth: 24 Frame count: 1 2. Convert a JPEG to GIF This is the GIF image that has the following header information: Format : GIF Format/Info : Graphics Interchange Format File size : 967 KiB Image Format : GIF89a Width : 470 pixels Height : 488 pixels Horizontal resolution : 96 dbi Vertical re resolution: 96 dbi Bit depth: 32 Frame count: 924 3. Convert a GIF and BMP to JPEG. Both BMP and GIF when convert to JPEG gives the same header information: Format : JPEG File size : 69.3 KiB Image Format : JPEG Width : 470 pixels Height : 488 pixels Resolution : 8 bits Horizontal resolution : 96 dbi Vertical re resolution: 96 dbi Bit depth: 24 Frame count: 1

VIDEO CONVERSION 1. Convert from AVI to MOV. 2. Convert from MOV to AVI.

AVI Video The AVI video has the following header information: Format : AVI Format/Info : Audio Video Interleave File size : 571 KiB
18 [Dr. Mohammed Fadle]

Computer Graphics Course

Duration : 7s 79ms Overall bit rate : 660 Kbps Director : Format Factory Writing application : Lavf52.25.0 Video Format : MPEG-4 Visual Format profile : Simple@L1 Format settings, BVOP : No Format settings, QPel : No Format settings, GMC : No warppoints Format settings, Matrix : Default Codec ID : DIVX Codec ID/Info : Project Mayo Codec ID/Hint : DivX 4 Duration : 6s 673ms Bit rate : 539 Kbps Width : 320 pixels Height : 240 pixels Display aspect ratio : 4/3 Frame rate : 29.970 fps Resolution : 24 bits Colorimetry : 4:2:0 Scan type : Progressive Bits/(Pixel*Frame) : 0.234 Stream size : 439 KiB (77%) Writing library : Lavc52.11.0 Audio Format : MPEG Audio Format version : Version 1 Format profile : Layer 3 Codec ID : 55 Codec ID/Hint : MP3 Duration : 7s 79ms Bit rate mode : Constant Bit rate : 128 Kbps Channel(s) : 2 channels Sampling rate : 44.1 KHz Resolution : 16 bits Stream size : 111 KiB (19%) Alignment : Aligned on interleaves Interleave, duration : 25 ms (0.74 video frame) Writing library : LAME3.98.2 Convert from AVI to MOV The header information for the new MOV video is: Format : MPEG-4 Format profile : QuickTime Codec ID : qt File size : 385 KiB Duration : 6s 989ms Overall bit rate : 451 Kbps Performer : Format Factory Encoded date : UTC 2010-04-27 18:20:14 Tagged date : UTC 2010-04-27 18:20:14
19 [Dr. Mohammed Fadle]

Computer Graphics Course

Writing application Video Format Codec ID Duration Bit rate mode Bit rate Width Height Display aspect ratio Frame rate mode Frame rate Bits/(Pixel*Frame) Stream size Encoded date Tagged date Audio Format Format/Info Format version Format profile Format settings, SBR Codec ID Duration Bit rate mode Bit rate Channel(s) Channel positions Sampling rate Resolution Stream size Encoded date Tagged date

: Lavf52.25.0 : DIVX : DIVX : 6s 722ms : Variable : 460 Kbps : 320 pixels : 240 pixels : 4/3 : Constant : 18.000 fps : 0.333 : 377 KiB (98%) : UTC 2010-04-27 18:20:14 : UTC 2010-04-27 18:20:14 : AAC : Advanced Audio Codec : Version 4 : LC : No : 40 : 6s 989ms : Variable : 3 148 bps : 2 channels :LR : 44.1 KHz : 16 bits : 2.69 KiB (1%) : UTC 2010-04-27 18:20:14 : UTC 2010-04-27 18:20:14

Convert from MOV to AVI The header information of AVI is the same but there are some differences we list them below: File size : 508 KiB Overall bit rate : 565 Kbps Video Duration : 6s 722ms Bit rate : 456 Kbps Frame rate : 18.000 fps Bits/(Pixel*Frame) : 0.330 Stream size : 374 KiB (74%) Audio Duration : 7s 367ms Stream size : 115 KiB (23%) Interleave, duration : 24 ms (0.43 video frame)
20 [Dr. Mohammed Fadle]

Computer Graphics Course

Graphics file formats:


File extension

MIME type

Graphic Proper name s type

Description

raster

.adrg

ARC Digitised 24-bit color raster images used mainly for spatial information. Raster Graphics

.adri

raster

ARC Digitised 24-bit color raster images. Raster Images

raster

ArtGem Project

.agp

AGP is a proprietary image file format developed by RL Vision for use in the paint software ArtGem. The format saves up to 16 layers of 24-bit color information with an 8-bit alpha channel.

.ai

application /illustrator

vector

Adobe Illustrator Artwork

Vector format for Adobe Illustrator (originally a subset of PostScript, if an appropriate file header was present).

raster

ART

.art

ART is a proprietary image file format mostly used by the America Online client software. The ART format holds a single still image that has been highly compressed. ART files are also the containers of textures and sprites on Ken Silverman's build engine.

image/bmp

raster

Windows Bitmap

.bmp

Commonly used by Microsoft Windows programs, and the Windows operating system itself. Lossless compression can be specified (RLE), but some programs use only uncompressed files.

.cadrg

raster

Compressed 24-bit color raster images used mainly ARC Digitised for spatial information. Raster
[Dr. Mohammed Fadle]

21

Computer Graphics Course

Graphics

application /CorelDRAW

vector

CorelDRAW Document

.cdr

Default proprietary format for Corel CorelDRAW 2-D documents. Features include multiple import/export filters, 3-D special effects and object/image layering.

image/cgm

vector

.cgm

Computer Graphics Metafile

Defined by ISO Standard 8632. Often used for complex engineering drawings, e.g. in the aviation industry. (CGM members)

.cin

image/cineon

raster

Cineon

Cineon is a subset of the ANSI/SMPTE DPX file format with fixed headers.

image/cpi

raster

.cpi

Cartesian Perceptual Compression

Hypercompressed format for blackand-white raster images. Typically compresses images 5-20 times smaller than corresponding TIFF or PDF versions, leading to dramatic reductions in download times and server network traffic.

raster

Corel PhotoPaint Image

.cpt

Default proprietary format for Corel Photo-Paint documents. Has many extra features such as image layering. Supported by very few image editing programs other than Corel Photo-Paint. Photo-Paint Images are usually smaller than Photoshop Documents.

image/dpx

vector

.dpx

Digital Picture DPX is an ANSI/SMPTE standard eXchange file (268M-2004) similar to Cineon but with flexible and variable image format
headers.

image/vnd.dxf

vector

.dxf

ASCII Drawing Interchange

Standard ASCII text files used to store vector data for CAD programs.

22

[Dr. Mohammed Fadle]

Computer Graphics Course

.eps

application /postscript

raster / vector

Encapsulated PostScript

A PostScript file that describes a small vector graphic, as opposed to a whole page or set of pages.

vector

.emf

Windows Enhanced Metafile

An enhanced version of Windows Metafile. Supported in Windows NT and later.

image/exr

raster

Extended Dynamic Range Image File Format

.exr

OpenEXR is the Open Source high dynamic-range (HDR) file format developed by Industrial Light & Magic for advanced imaging in movie production. The main advantage of that format are up to 32-bit floating-point pixels and multiple lossless image compression algorithms up to 2:1 lossless compression on film grained images.

vector

.fh

Macromedia Freehand Document

Vector format for Macromedia Freehand.

vector

.fla

Flash Source File

Shockwave Flash source file, only usable by Macromedia Flash authoring software.

image/vnd.fpx

raster

.fpx

FlashPix (1.0.2)

Uncompressed / lossy, 8-bit grayscale & 24-bit color. Provides multiple resolutions of each image.

image/gif

raster

Graphics Interchange Format

.gif

GIF is used extensively on the web. Supports animated images. Supports only 255 colors per frame, so requires lossy quantization for full-color photos (dithering); using multiple frames can improve color precision. Uses lossless LZW compression, which used to make GIF sometimes undesirable due to LZW patent (now expired) issues.

.iff
23

raster

Interchange

File format popular on the Amiga computer. ILBM is a subtype of the


[Dr. Mohammed Fadle]

Computer Graphics Course

.ilbm

file format / Interleave bitmap

IFF fileformat, which can contain more than just pictures. It is a true bitplane format, so it can display from 2 up to 262.144 colors and supports even palettes of only 4, 8, 16, 32, 64, 128 colors that are uncommon for other formats. It commonly uses 32 colours from 4096 palette (Amiga OCS), and a proprietary mode storing 4096 colors palette in 5 bitplanes called Hold&Modify (HAM) or 16 millions in only 8 bitplanes (HAM 8). But full 12 bit 4096 colors and full 24 bit version exist. It usually employs a lossless compression.

image/iges

vector

.igs

Initial Graphics Exchange Specification

IGES is an ASCII text neutral data format used extensively for CAD/CAM data exchange. It supports 2D and 3D curves and surfaces, as well as solid models and annotation.

image/jpeg

raster

.jpeg .jpg

JPEG is used extensively for photos Joint Photographic and other continuous tone images on Experts Group the web. Uses lossy compression by

trying to equalize eight by eight pixel blocks; the quality can vary greatly depending on the compression settings.

image/jp2

raster

JPEG 2000 is the successor of popular Joint Photographic "JPEG", a new wavelet based file Experts Group format that includes both lossy and

.jpg2 .jp2

lossless compression options. It's commonly considered the actual "stateof-the-art" lossy format for photographic imaging, however its support in modern systems is still weak due to heavy requirements for hardware and many patents for software.

video/x-mng

raster

.mng

Multipleimage Network Graphics

Animation format using datastreams similar to PNG and JPEG, originally designed to replace the use of animated GIF on the web.

24

[Dr. Mohammed Fadle]

Computer Graphics Course

.myd

raster

Myd format

A raster format supported in many programs, 3bpp format

.myv

vector

Myv vector format

A vector format supported in many programs such as M-DraW

.odg

vector

OpenDocume A vector format supported by Draw from OpenOffice.org suite nt drawing

.pbm

image /x-portablebitmap

raster

Portable Bitmap Format

A simple black and white graphics format. It uses 1 bit per pixel. It is related to the PGM (grayscale) and PPM (color) graphics file formats.

.pcd

image/jpcd ??

raster

ImagePac Photo CD

Proprietary Kodak format, lossy, 24-bit color.

image/pcx

raster

PCX

.pcx

Developed by ZSoft Corporation, uses a simple form of run-length encoding, supports palette-based and 24-bit RGB images.

application/pdf

raster / vector

Portable Document Format

.pdf

A page description language (loosely based on Postscript, but not a programming language), which allows for files containing multiple pages and links. Works with Adobe Acrobat Reader or Adobe eBook Reader, or third-party compatible software. The "native" metafile format for Mac OS X.

.pgm

image /x-portablegraymap

raster / vector

Portable Graymap Format

A simple gray scale graphics format. It uses 8 bits per pixel. Unlike most graphics file formats, a PGM file is plain text and can be processed with text processing tools. It is related to the PBM (black and white) and PPM (color) graphics file formats.

.pict .pct
25

image/pict

raster /

Picture

Default for Macintosh operating

[Dr. Mohammed Fadle]

Computer Graphics Course

.pic
image/png

vector

systems before version OS X.

raster

.png

Portable Network Graphics

PNG is an image format with lossless compression, offering bit depths from 1 to 48. It was mainly designed to replace the use of GIF on the web. Free of the patent, which expired in 2003, associated with GIF.

image /x-portablepixmap

raster

Portable Pixmap Format

.ppm

A simple color graphics format. It uses 24 bit per pixel, 8 for red, 8 for blue, and 8 for green. Unlike most graphics file formats, a PPM file is plain text and can be processed with text processing tools. It is related to the PBM (black and white) and PGM (grayscale) graphics file formats.

application /postscript

vector

PostScript

.ps

Generic vector-based page description language, created and owned by Adobe. Postscript is a powerful stackbased programming language. Supported by many laser printers.

application /x-photoshop

raster

Photoshop Document

.psd

Default proprietary format for Adobe Photoshop documents. Has many extra features such as image layering. Also supported by some other image editing programs than Adobe Photoshop.

.psp .pspimag e

raster / vector

Standard Corel (formerly Jasc) format Paint Shop Pro Document for Paint Shop Pro and Paint Shop Pro Photo documents, similar to .psd for Photoshop. Supported by very few other programs.

.px

raster / vector

Pixel image

Crossplatform proprietary image format used by Pixel image editor.

.sgi .rgb .rgba .int


26

raster

Silicon Graphics Image

Native image format for Silicon Graphics workstations.

[Dr. Mohammed Fadle]

Computer Graphics Course

.inta .bw
image/svg+xml vector Scalable Vector Graphics
An XML based vector graphics format, as defined by the World Wide Web Consortium for use in web browsers.

.svg .svgz

.swf

application /x-shockwaveflash

vector

Small Web Format (commonly referred to as Shockwave Flash)

Flash is a web page plug-in that displays vector based animations contained in SWF files. Several applications can create SWF files; these include the Flash authoring tool from Macromedia.

vector

.sxd

OpenOffice 1.0 drawing format

A vector format that become outdated since version 2.0 of OpenOffice

image/tiff

raster

.tiff .tif

Tagged Image TIFF is used extensively for traditional print graphics. Lossy and lossless File Format
compression available, but many programs only support a subset of available options.

Ulead File for UFO is used primarily for editing images, possibly similar to PSD. It Objects
supports object saving and transparency, but apparently only Ulead PhotoImpact and VideoStudio are able to use it.[1] An image of this type is apparently not subject to generation loss. [2]

.ufo

image/tga

raster

Truevision TGA

.tga
image /vnd.wap.wbmp raster Wireless Application Protocol Bitmap Format

TGA is the native format of Truevision Inc.'s TARGA boards, which were some of the first graphic cards for IBM-compatible PCs to support truecolor display. Mainly used with WML for wireless devices.

.wbmp

27

[Dr. Mohammed Fadle]

Computer Graphics Course

image/x-wmf

vector

.wmf
application/xaml vector +xml

Windows Metafile

Stores vector graphics and raster graphics as a sequence of commands to be issued to the graphics layer of the Microsoft Windows operating system. The XML-based file format for representing a document built atop the Windows Presentation Foundation. Can declare 2D vector graphics (and include references to external bitmaps for imaging), textual documents (with or without page fidelity), 2D user interfaces, and renderings of 3D models (with a fair amount of baseline support for lighting, materials, etc.) Fully documented vector graphics format used by Xara X and Xara Xtreme. Ultra compact. Native B&W format for the X Window System, supported by most web browsers. XBM is an ASCII format which uses no compression; since files are in C(++) syntax, images can be included in source code. Native format for the GIMP. Has many extra features such as image layering. Used mostly in the GIMP, but also readable by ImageMagick. Used almost exclusively on UNIX platforms with the X Window System, inspired by the XBM format.

XAML

.xaml

.xar

application/vnd.x vector ara image/x-xbitmap raster

Xar

X BitMap

.xbm

application /x-gimp-image

raster

.xcf

XCF, name derived from eXperimental Computing Facility X-Pixmap

image/x-xpm

raster

.xpm

28

[Dr. Mohammed Fadle]

Computer Graphics Course

JPEG
In computing, JPEG (pronounced JAY-peg; IPA: [depg]) is a commonly used standard method of compression for photographic images. The name JPEG stands for Joint Photographic Experts Group, the name of the committee who created the standard. The group was organized in 1986, issuing a standard in 1992 which was approved in 1994 as ISO 10918-1. JPEG should not be confused with MPEG, the Moving Picture Experts Group, which produces compression schemes for motion pictures. JPEG provides for lossy compression of images (although there are variations on the standard baseline JPEG which are lossless). The file format which employs this compression is commonly also called JPEG; the most common file extension for this format is .jpg, though .jpeg, .jpe, .jfif and .jif are also used. JPEG itself specifies both the codec defining how an image is transformed into a stream of bytes, and the file format used to contain that stream. The file format is known as 'JPEG Interchange Format' (Often confused with the JPEG File Interchange Format), and is specified in Annex B of the standard. It is possible for JPEG data to be embedded in other file types, such as TIFF format images. JPEG/JFIF is the format most used for storing and transmitting photographs on the World Wide Web. For this application, it is preferred to formats such as GIF, which has a limit of 256 distinct colors that is insufficient for color photographs, and PNG, which produces much larger image files for this type of image. The compression algorithm is not as well suited for line drawings and other textual or iconic graphics, and thus the PNG and GIF formats are preferred for these types of images.

JPEG Codec
Encoding
Many of the options in the JPEG standard are not commonly used. Here is a brief description of one of the more common methods of encoding when applied to an input that has 24 bits per pixel (eight each of red, green, and blue). This particular option is a lossy data compression method. Color space transformation First, the image should be converted from RGB into a different color space called YCbCr. It has three components Y, Cb and Cr: the Y component represents the brightness of a pixel, the Cb and Cr components represent the chrominance (split into Blue and Red components). This is the same as the color space used by PAL, MAC and Digital color television transmission (but not by NTSC, which uses the similar YIQ color space). Note that this step is optional ; many "high quality" JPEG images do not apply this step (although it would greatly enhance the quality of images compressed at moderate

29

[Dr. Mohammed Fadle]

Computer Graphics Course

compression ratios), and keep them in the sRGB color space, where each color plane is compressed and quantized separately with similar quality levels. Block splitting After subsampling each channel must be split into 8x8 blocks, if the data for a channel does not represent an integer number of blocks then the encoder must fill the remaining area of the incomplete blocks with some form of dummy data:

filling the edge pixels with a fixed color (typically black) creates dark artefacts along the visible part of the border repeating the edge pixels is a common but non-optimal technique that avoids the visible border, but it still creates artefacts with the colorimetry of the filled cells a better strategy is to fill pixels using colors that preserve the DCT coefficients of the visible pixels, at least for the low frequency ones (for example filling with the average color of the visible part will preserve the first DC coefficient, but best fitting the next two AC coefficients will produce much better results with less visible 8x8 cell edges along the border).

Downsampling The human eye can see more detail in the Y component than in Cb and Cr. Using this knowledge, encoders can be designed to compress images more efficiently. The above transformation enables the next step, which is to reduce the Cb and Cr components (called "downsampling" or "chroma subsampling"). The ratios at which the downsampling can be done on JPEG are 4:4:4 (no downsampling), 4:2:2 (reduce by factor of 2 in horizontal direction), and most commonly 4:2:0 (reduce by factor of 2 in horizontal and vertical directions). For the rest of the compression process, Y, Cb and Cr are processed separately and in a very similar manner. Downsampling the chroma components saves 33% or 50% of the space taken by the image. Discrete cosine transform

The DCT transforms 64 pixels to a linear combination of these 64 squares The 8x8 subimage shown in 8-bit greyscale

30

[Dr. Mohammed Fadle]

Computer Graphics Course

The compressed 8x8-squares are visible in the scaled up picture, together with other visual artifacts of the lossy compression Next, each component (Y, Cb, Cr) of the image is "tiled" into sections of eight by eight pixels each, then each tile is converted to frequency space using a two-dimensional forward discrete cosine transform (DCT, type II). Entropy coding zigzag ordering of JPEG image components Entropy coding is a special form of lossless data compression. It involves arranging the image components in a "zigzag" order employing run-length encoding (RLE) algorithm that groups similar frequencies together, inserting length coding zeros, and then using Huffman coding on what is left. The JPEG standard also allows, but does not require, the use of arithmetic coding which is mathematically superior to Huffman coding. However, this feature is rarely used as it is covered by patents and because it is much slower to encode and decode compared to Huffman coding. Arithmetic coding typically makes files about 5% smaller.

This image shows the (accentuated) difference between a jpg-saved image and the original. Note especially the changes occurring near sharp edges. The resulting compression ratio can be varied according to need by being more or less aggressive in the divisors used in the quantization phase. Ten to one compression usually results in an image that cannot be distinguished by eye from the original. 100 to one compression is usually possible, but will look distinctly artifacted compared to the original. The appropriate level of compression depends on the use to which the image will be put. Those who use the World Wide Web may be familiar with the irregularities known as compression artifacts that appear in JPEG images. These are due to the quantization step of the JPEG algorithm. They are especially noticeable around eyes in pictures of faces. They can be reduced by choosing a lower level of compression; they may be eliminated by saving an image using a lossless file format, though for photographic images this will usually result in a larger file size. Compression artifacts make low-quality JPEGs unacceptable for storing
31 [Dr. Mohammed Fadle]

Computer Graphics Course

heightmaps. The images created with ray-tracing programs have noticeable blocky shapes on the terrain. Some programs allow the user to vary the amount by which individual blocks are compressed. Stronger compression is applied to areas of the image that show fewer artifacts. This way it is possible to make a JPEG file smaller and prettier by hand.

Lossless editing
A number of alterations can be performed to a JPEG image without any quality loss. Blocks can be rotated in 90 degree increments, flipped in the horizontal vertical and diagonal axes and moved about in the image. Not all blocks from the original image need to be used in the modified one. The top and left of a JPEG image must lie on a block boundary, but the bottom and right need not do so. This limits the possible lossless crop operations, and also what flips and rotates can be performed on an image whose edges do not lie on a block boundary for all channels. It is also possible to transform between baseline and progressive formats without any loss of quality, since the only difference is the order in which the coefficients are placed in the file. Furthermore, if a JPEG is decompressed, edited, and then recompressed using the same chroma subsampling and quantisation tables, then unedited areas of the image should have minimal quality loss. When using lossless cropping, it is important to realise that if the bottom or left side of the crop region is not on a block boundary then the rest of the data from the partially used blocks will still be present in the cropped file and can be recovered relatively easily by anyone with a hex editor and an understanding of the format.

Photographs
JPEG compression artifacts blend well into photographs with detailed non-uniform textures, allowing higher compression ratios. Notice how a higher compression ratio first affects the high-frequency textures in the upper-left corner of the image, and how the contrasting lines become more fuzzy. The very high compression ratio severely affects the quality of the image, although the overall colors and image form is still recognizable. However, the precision of colors suffer less (for a humane eye) than the precision of contours (based on luminance). This justifies the fact that images should be first transformed in a color model separating the luminance from the chromatic information, before subsampling the chromatic planes (which may also use lower quality quantization) in order to preserve the precision of the luminance plane with more information bits.

Medical Imaging: JPEG's 12-bit mode


There are many medical imaging systems that create and process 12-bit JPEG images. The 12-bit JPEG format has been part of the JPEG specification for some time, but very few consumer programs (including web browsers) support this rarely used JPEG format.
32 [Dr. Mohammed Fadle]

Computer Graphics Course

Graphics and Sound File Formats


Introduction
This document discusses file formats commonly used with Windows, Macintosh, or Unix computers to represent two-dimensional images and sounds. Special attention is paid to their use on the Internet, particularly the World Wide Web.

1. Graphics File Formats


The term "Graphics file" is used to refer to a computer file containing any sort of graphical, non-textual information: diagrams, charts, scanned-in images, files created by painting programs, and so on. Graphics files not covered in this Backgrounder include those used only by one program or by a very small set of programs, as well as those (such as the files which fax machines send to each other) used only behind the scenes. Finally, this document will not cover file formats used widely in a specific field but not elsewhere, such as those used by Computer Aided Design systems or by Geographic Information Systems. There are two main kinds of graphics file, raster (or bitmapped) and vector. Raster formats, which are more common, store information about individual pixels -- the tiny picture elements that provide atoms of colour, like dabs of paint in a Pointillist painting. Vector formats, on the other hand, store information about the lines and curves that make up a drawing. Both make use of compression algorithms, which are methods of storing electronic information (of any sort) in a smaller space.

1.1 Raster Formats


GIF (Graphics Interchange Format) can be recognized by the ".gif" extension and is the most common format for graphical information on the Internet. The format was developed by CompuServe Incorporated in 1987 (the GIF87a format), and an improvement was made in 1989 (the GIF89a format). GIF files can only contain 256 colours, but the format is popular nonetheless for lower resolution image data: 256 colours is sufficient for many applications. GIF uses a compression algorithm called LZW, (for Lempel-Ziv Welch, its developers), that works very well for line drawings and for files containing large areas of the same colour. LZW encoding has the further advantage that it requires only one pass, so images can be displayed while being decoded. This compression algorithm is the main reason this file format is so popular -- not only are GIF files small relative to the amount of information they contain, but they can be displayed immediately. Further, GIF was designed to display reasonably on any form of display, showing any number of colours. This is a major benefit on the Internet where people use a wide variety of computer systems. GIFs can have one colour selected as transparent, which means that pixels of that colour will appear the same as the pixels directly "behind" them on the screen. For
33 [Dr. Mohammed Fadle]

Computer Graphics Course

example, if a Web page has a pink background and a "transparent GIF" is displayed on that page, the transparent pixels will appear pink, even if they show up as a different colour in a paint program. GIFs may also be interlaced, which means that the rows of pixels making up the image are not displayed in sequential order from top to bottom. Instead, slices of the graphic are displayed throughout the image that are gradually built up during the decoding process. The effect on the screen is that of an entire image, though initially very blurry, that is gradually sharpened in a series of passes. This is in contrast to a non-interlaced image that begins to appear as a completely clear sliver at the top of the image, that drops like a curtain to the bottom. The advantage of interlacing is that it quickly provides an overview of what the picture looks like before going on to fill in the details. JPEG (Joint Photographic Experts Group) format can be recognized by the ".jpg" or ".jpeg" extension and is also quite popular on the Internet. Strictly speaking, JPEG is not a file format but a compression algorithm commonly used with JFIF (JPEG File Interchange Format), developed by C-Cube Microsystems. However, the two formats are almost always found together. The official format to be used with JPEG is actually SPIFF (Still Picture Information File Format), which is much superior to JFIF. It will, however, take some time to supplant JFIF simply because there are currently so many JFIF files. JPEG uses a lossy compression algorithm. Lossy compression means that some image data is thrown away in order to compress a file into a smaller file size -- what you get out when you decompress is not exactly what you put in when you compressed it. While the loss of data may sound undesirable, there are several reasons why it can be used to advantage:

The lossy compression scheme was devised with the capabilities of the human eye in mind, so the main areas of information loss are in places where they are not typically noticed. The person compressing the file has the option of specifying the degree of loss. The higher the degree, the smaller the compressed file and the faster it is to decode it, but the lower the image quality. Allowing for loss means that the file can be compressed more than it would be otherwise -- specifically, about 4 times as much as GIF, at standard settings.

However, it is not a good idea to open, save, and close a JPEG file repeatedly, since more information is lost every time. After a number of repetitions, the effect becomes noticeable. Progressive JPEG works on the same principle as interlaced GIFs, providing a fast, low- quality image, and then filling in the details as more data arrive. Progressive JPEGs display faster than interlaced GIFs. PCX (ZSoft Paint) format, with a ".pcx" extension, is the oldest, most widely recognized graphic file format used for MS-DOS. It was developed in the early 1980s

34

[Dr. Mohammed Fadle]

Computer Graphics Course

by ZSoft Corporation; the format has become outdated since the company dissolved. PCX been superseded by the Windows Bitmap Format. Windows Bitmap Format can be recognized by the ".bmp" extension and is the default format for computers using the Windows operating system. It was developed by Microsoft Corporation, and provides a simple, efficient means of storing a wide variety of graphical data. PICT (Macintosh Picture format) can be recognized by the ".pict" extension and is the standard image file format for the Apple Macintosh. PNG (Portable Network Graphics) format, pronounced ping and recognized by the ".png" extension, is currently under development. It is intended to supersede GIF, circumventing the legal difficulties involved with the compression algorithm used in that format, as well as adding useful features such as truecolor and error detection, and a faster version of interlacing. (GIF was recently involved in several lawsuits, the result of which was that people writing programs that create or display GIF files must license them. This does not affect people who simply use the programs or GIF files, only people writing those programs. PNG, as an open standard, does not have this legal entanglement.) TGA (Truevision File Format) can be recognized by the ".tga" extension and is rarely seen nowadays, but it is still encountered in discussions on file formats (such as this one). It is often mistakenly called the "Targa" file format, after the first program to use it. TIFF (Tag Image File Format), which can be recognized by the ".tif" or ".tiff" extension, was designed to be powerful and flexible. It stores a very large amount of information about an image, and works well as an intermediary file format between scanners or paint programs and desktop publishing programs. One would scan or paint an image, save it as a TIFF file, import it into a desktop publishing program, and save it as another format. This actually works very well. The use of TIFF has been limited, however, since it is very complex. TIFF was developed in 1988 by Aldus Corporation, in cooperation with Microsoft Corporation. XBM (X BitMap Format), with an ".xbm" extension, is the default format for computers using the X operating system. Unlike files in other formats, which are simply collections of data, XBM files are actually C source code, and are deciphered by a C compiler rather than by a graphics program.

1.2 Vector Formats


PostScript uses a ".ps" extension and was created by Adobe Systems. It is a page description language that is recognized by many printers, and is commonly used for text formatting and simple graphics. It is actually a programming language, like XBM.

35

[Dr. Mohammed Fadle]

Computer Graphics Course

Encapsulated PostScript uses a ".eps" extension and was also created by Adobe Systems. It is very closely related to PostScript; Encapsulated PostScript files are subroutines that can be included in PostScript files. Portable Document File denoted by a ".pdf" extension is yet another Adobe Systems product. Adobes intention is to create a displayable form PostScript that can also be printed on any printer. The PDF, or Acrobat, format is currently used on the Web to deliver documents, though its use is much less than HTML. Its main advantage is that it requires no additional markup, as with HTML documents, before it can be made available online. Main disadvantages include the fact that, unlike HTML, the PDF format is proprietary, and the present generation of Web robots and spiders cannot index it. WMF (Windows Meta File) with a ".wmf" extension is the default vector format for computers using the Windows operating system. It was developed by Microsoft Corporation.

1.3 GIF and JPEG on the Web


The two most common graphics file formats on the World Wide Web are GIF and JPEG, and it is worth comparing the two directly. GIF has the advantages of being lossless, having the option of transparency, and being good at compressing large areas of a single colour. JPEG has the advantages of greater compression in general, many more available colours (16 million, compared with GIF's 256), and being good at compressing images with many subtle distinctions, such as photographs. Although JPEG is a lossy compression, it stores much more information than GIF to begin with, so real- world images still turn out much better when stored as JPEG images. GIF, on the other hand, is much better at storing anything with sharp lines, including text or any black-and-white image. GIF is also particularly good at grayscale images, since it can display an image of up to 256 grays without loss, which JPEG cannot. In general, inline images on the Web are in GIF format, although JPEGs are also beginning to appear. Many browsers do recognize JPEG inline images, but not all. Thus, it is a good idea to use GIFs to ensure that all graphical Web browsers can display the images.

1.4 Other Graphics Extensions


Besides the extensions found in the list above, one might also encounter ".pic", ".img", ".rgb", ".raw", ".asc", or ".map". These extensions are each used to identify several different formats -- and thereby succeed in identifying none. For this reason, many graphics programs will identify graphics files based on their internal structure instead of by name.

36

[Dr. Mohammed Fadle]

Computer Graphics Course

1.5 Some URLs for more information about Graphics Formats


http://www.cis.ohio-state.edu/hypertext/faq/usenet/graphics/fileformatsfaq/top.html http://www.cis.ohio-state.edu/hypertext/faq/usenet/jpeg-faq/top.html http://www.dcs.ed.ac.uk/~mxr/gfx/faqs/JPEG.faq http://www.dcs.ed.ac.uk/~mxr/gfx/tiff-5.0.spec http://www.phys.s.u-tokyo.ac.jp/local/other-faq/gif89a-e.html

2. Sound File Formats


There are three parameters that are common to every sound file and affect the size of that file.

Sampling Rate: Most digital sound files save information as a long series of sound samples, in the same way a film saves moving pictures as a series of still images. The quality of a sound file can be increased by taking more of these samples in the same amount of time; that is, increasing the sampling rate. This has the effect, however, of increasing the file size. Bits per Sample: Commonly, either 8 or 16 bits are used to represent each sample. Using 16 bits provides for much better quality, but produces files twice as large as 8-bit files. Number of Channels: Because they work with two separate audio channels, stereo files are usually about twice the size of mono files. It is theoretically possible to record any number of channels, with a concomitant increase in file size. For example, a file intended to be played on a surround-sound system may record seven or more channels, and will thus be about seven times the size of a mono version of the same sound.

Thus, a file containing a 5-second mono 8-bit sound, with a sampling rate of 8000 samples per second, will have a size of at least 588000 = 320,000 bits, or 40,000 bytes -- about 39K. (This is basically the minimum size for a 5-second sound file, and represents a fairly low sound quality. As can be seen, sound files are quite large, and are surprisingly hard to compress.) These values are specified when the sound is recorded. You can convert from one value to another, but you cannot increase the quality of the sound by doing so; saving a mono sound file as stereo has no effect other than doubling the file size.

2.1 Common Sound File Formats


Sun mLaw (pronounced "mu-law" and often written "ulaw"), with an ".au" extension, is most commonly used on NeXT and Sun computers. This is the most widely recognized sound format on the Internet, challenged only by the Windows-specific RIFF WAVE format.

37

[Dr. Mohammed Fadle]

Computer Graphics Course

RIFF WAVE ".wav" is Microsoft Windows' own sound file format and can be widely found on the Internet. AIFC (AIF with Compression) ".aif" or ".aiff" is most commonly used on Apple and SGI computers. It shares these extensions with uncompressed AIFF (Audio IFF) files, but this is transparent to the user. HCOM uses the extension ".hcom" and is most commonly used on Macintoshes. IFF/8SVX can be identified by the ".iff" extension and is most commonly used on Amiga computers. MOD (Amiga SoundTracker) can be recognized by the ".mod" or ".nst" extensions and started out strictly for the Amiga, but is now used widely. One reason for this is that it integrates sampled sounds very easily, and can use them among up to 31 instruments in a particular sound file. NeXT snd with the extension ".snd" is most commonly used on NeXT and Sun machines -- watch out for this extension because it shares it with many others, as indicated by the three described below. Mac snd also uses the ".snd" as well as the ".fssd" extensions; it is commonly used on Mac and PC computers. Amiga snd is also indicated by the ".snd" extension and is another Amiga format that adds to the confusion generated by the above two file types, however, Amiga snd is not widely used. Tandy snd is yet another ".snd" format made for the Tandy computer, but it is associated with a particular program and so does not tend to be widely distributed. Soundblaster The extension ".voc" is most commonly used by the Soundblaster sound card. Although this is a proprietary format, Soundblaster is the de facto standard sound card for IBM microcomputers.

2.2 MIDI Files


The Musical Instrument Digital Interface system (MIDI) is designed to interconnect home computers, synthesizers, and so on with a standard interface. A MIDI file describes how each instrument in a synthesized band or orchestra plays -- where "instrument" is defined fairly loosely and may refer to anything that makes a sound. MIDI files are often named with a ".mid" or ".midi" extension, and (because they store information in such a different manner from other sound files) are rarely found near other sound files.

38

[Dr. Mohammed Fadle]

You might also like