JPEG: Currently the Most Important Common File Format
Total Page:16
File Type:pdf, Size:1020Kb
Main Reference • Ze-Nian Li and Mark S Drew, Fundamentals of Multimedia, second edition. 2 Chapter Three Graphics and Image Data Representations 3 Content 3-1: Graphics/Image Data Types 3-2: Popular File Formats. 4 Outlines • This chapter introduces: ▪ how best to represent the graphics and image data since it is of crucial importance in the study of multimedia. ▪ Starting with 1-bit images, then 8-bit gray images, then 24- bit color images and 8-bit versions of color images. • The specifics of file formats for storing such images are also discussed. 5 3.1 Graphics/Image Data Types • Table 3.1 shows a list of file formats used in the popular product Adobe Premiere. • We concentrate on GIF and JPG image file formats, since the GIF file format is one of the simplest and contains several fundamental features, • and the JPG file format is arguably the most important overall. 6 3.1 Graphics/Image Data Types 7 3.1.1 1-Bit Images • Images consist of pixels (picture elements in digital images). • A 1-bit image (also called binary image) consists of on and off bits only and thus is the simplest type of image. • Each pixel is stored as a single bit (0 or 1). • It is also sometimes called a 1-bit monochrome (called Lena image by multimedia scientists) image since it contains no color. See Figures in next two slides. • 1-bit images can be satisfactory for pictures containing only simple graphics and text. • Fax machines use 1-bit data, so in fact 1-bit images are still important, even though storage capacities have increased enough to permit the use of imaging that carries more information. 8 3.1.1 1-Bit Images 9 3.1.1 1-Bit Images • A 640 × 480 monochrome image requires 38.4 kilobytes (kB) of storage. • {[(640 × 480)Bits /8] = 38400 Bytes} / 1000 = 38.4 Kilobytes. 10 3.1.2 8-Bit Gray-Level Images • 8-bit image is one for which each pixel has a gray value between 0 and 255. • Each pixel is represented by a single byte - for example, a dark pixel might have a value of 10, and a bright one might be 230. • The entire image can be thought of as a two-dimensional array of pixel values referred to as a bitmap, a representation of the graphics/image data that parallels the manner in which it is stored in video memory. • Image resolution refers to the number of pixels in a digital image (higher resolution always yields better quality but increases size) 11 3.1.2 8-Bit Gray-Level Images 12 3.1.2 8-Bit Gray-Level Images • Fairly high resolution for such an image might be 1,600 × 1,200, whereas lower resolution might be 640 × 480. • Notice that here we are using an aspect ratio of 4:3. • We do not have to adopt this ratio, but it has been found to look natural. • For this reason 4:3 was adopted for early TV (As we will see in Ch5) and most early laptop screens. • Later displays typically use an aspect ratio of 16:9, to match high-definition video and TV. 13 3.1.2 8-Bit Gray-Level Images • Such an array must be stored in hardware; we call this hardware a frame buffer. • Special (relatively expensive) hardware called a “video” card (actually a graphics card) is used for this purpose. • The resolution of the video card does not have to match the desired resolution of the image, but if not enough video card memory is available, the data have to be shifted around in RAM for display. • We can think of the 8-bit image as a set of 1-bit bitplanes, where each plane consists of a 1-bit representation of the image: a bit is turned on if the image pixel has a nonzero value at that bit level. 14 3.1.2 8-Bit Gray-Level Images • Figure 3.2 displays the concept of bitplanes graphically. • Each bitplane can have a value of 0 or 1 at each pixel but, together, all the bitplanes make up a single byte that stores values between 0 and 255 (in this 8-bit situation). 15 3.1.2 8-Bit Gray-Level Images • 640×480 grayscale image requires 300kB of storage. • [(640 × 480) = 38400 Bytes] / 1000 = 307.2 Kilobytes. 16 3.1.4 24-Bit Color Images • In a color 24-bit image, each pixel is represented by three bytes, usually representing RGB. • Since each value is in the range 0–255, this format supports 256×256×256, or a total of 16,777,216, possible combined colors; which increases storage size. • a 640 × 480 24-bit color image would require 921.6 kB of storage. (without any compression applied) • Compression is used to decrease the image size by simply grouping pixels effectively. (chapter 7). 17 3.1.4 24-Bit Color Images • An important point to note is that many 24-bit color images are actually stored as 32-bit images, with the extra byte of data for each pixel storing an α (alpha) value representing special-effect information. • Figure 3.5 shows the image forestfire.bmp, a 24-bit image in Microsoft Windows BMP format (discussed later in the chapter). • Also shown are the grayscale images for just the red, green, and blue channels, for this image. • Taking the byte values 0 .. 255 in each color channel to represent intensity, we can display a gray image for each color separately. 18 3.1.4 24-Bit Color Images 19 3.1.4 24-Bit Color Images 20 3.1.5 Higher Bit-Depth Images • Among image formats that are usually not compressed if possible are ones that • Require maximum faithfulness to the viewed scene for various reasons such as medical liability. • For example, an image of a patient’s liver had better represent the colors red and purple, say, very accurately! • Other image formats recognize that more information about the scene being imaged can be gained by using special cameras that view more than just three colors, i.e., RGB. • Here the idea might be to use invisible light (e.g., infrared, ultraviolet) for security cameras, say, or to produce medical images of skin that can utilize the additional colors to better diagnose skin ailments such as carcinoma. 21 3.1.5 Higher Bit-Depth Images • Another reason for using high bit-depth is in satellite imaging, where extra information can give indication of types of crop growth, etc.: here, the cost of simply lifting the camera into high altitude or into space motivates the idea of obtaining as much information as possible, perhaps even if we cannot as yet make use of all the data. • Such images are called multispectral (more than three colors) or hyperspectral (a great many image planes, say 224 colors for satellite imaging). 22 3.1.6 8-Bit Color Images • If space is a concern (and it almost always is—e.g. we don’t want to fill up our smartphone memory needlessly), reasonably accurate color images can be obtained by quantizing the color information to collapse it. • Color quantizing example: reducing the number of colors required to represent a digital image makes it possible to reduce its file size. • Many systems can utilize color information stored with only 8 bits of information (the so-called 256 colors) in producing a screen image. 23 3.1.6 8-Bit Color Images • Even if a system has the electronics to actually use 24-bit information, backward compatibility demands that we understand 8-bit color image files, as well as their being smaller in size and quite useful. • There are tricks that can be used only for such imagery. • 8-bit color image files use the concept of a lookup table to store color information. • Basically, the image stores not color but just a set of bytes, each of which is an index into a table with three byte values that specify the 24-bit color for a pixel with that lookup table index. 24 3.1.6 8-Bit Color Images • For example, • if exactly 23 pixels have RGB values (45, 200, 91) • then store the value 23 in a three-dimensional array, at the element indexed by the index values [45, 200, 91]. • This data structure is called a color histogram. • color histogram: is a very useful tool for image transformation and manipulation in Image Processing. 25 3.1.6 8-Bit Color Images • Notice that the difference between Fig. 3.5a, the 24-bit image, and Fig. 3.7, the 8-bit image, is reasonably small. Fig. 3.5a, the 24-bit image Fig. 3.7, the 8-bit image 26 3.1.6 8-Bit Color Images • Another example for difference between the 24-bit image, and the 8-bit image. The 24-bit image The 8-bit image 27 3.1.6 8-Bit Color Images • Note the great savings in space for 8-bit images over 24-bit ones: a 640 × 480 8-bit color image requires only 300 kB of storage, compared to 921.6 kB for a color image (again, without any compression applied). 28 3.1.7 Color Lookup Tables • The LUT is often called a palette. • The idea is to store only the index, or code value, for each pixel. • if a pixel stores, say, the value 25 (Figure 3.8), the meaning is to go to row 25 in a color lookup table (LUT). 29 3.1.7 Color Lookup Tables •A Color-picker consists of an array of fairly large blocks of color (or a semi-continuous range of colors) such that a mouse-click will select the color indicated.