graphics file formats. 2 graphics data n vector data –lines –polygons –curves n bitmap data...

40
Graphics File Formats Graphics File Formats

Post on 21-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

Graphics File FormatsGraphics File Formats

Graphics File Formats 2

Graphics DataGraphics Data

Vector dataVector data– LinesLines– PolygonsPolygons– CurvesCurves

Bitmap dataBitmap data– Array of pixelsArray of pixels– Numerical values corresponding to Numerical values corresponding to

gray-level or color of set of pixelsgray-level or color of set of pixels

Graphics File Formats 3

Types of FormatsTypes of Formats

Bitmap Bitmap – TIFF, GIF, JPEGTIFF, GIF, JPEG

VectorVector– AutoCAD DXFAutoCAD DXF

MetafileMetafile– Can contain both bitmap and vector Can contain both bitmap and vector

data in the same filedata in the same file– Macintosh PICTMacintosh PICT

Graphics File Formats 4

Types of FormatsTypes of Formats

AnimationAnimation– TDDD, TTDDDTDDD, TTDDD

MultimediaMultimedia– Apple QuickTimeApple QuickTime– MPEGMPEG

Graphics File Formats 5

Types of FormatsTypes of Formats

3D3D– Descriptions of shape and color of 3D Descriptions of shape and color of 3D

object models (scene elements)object models (scene elements)– Models placed in scenes with lights Models placed in scenes with lights

and camerasand cameras– Autodesk’s DXFAutodesk’s DXF– Used by rendering programs like Used by rendering programs like

Autodesk’s 3D StudioAutodesk’s 3D Studio

Graphics File Formats 6

Types of FormatsTypes of Formats

VRMLVRML– Hybrid of 3D graphics and HTMLHybrid of 3D graphics and HTML

AudioAudio VideoVideo FontsFonts

Graphics File Formats 7

Pixels and CoordinatesPixels and Coordinates

Graphics File Formats 8

DisplayDisplay

Fewer colors than device can displayFewer colors than device can display

Graphics File Formats 9

DisplayDisplay

More colors than device can More colors than device can displaydisplay

Graphics File Formats 10

DisplayDisplay

Quantization artifactsQuantization artifacts– BandingBanding– Moire patternsMoire patterns– New colors not present in imageNew colors not present in image

Graphics File Formats 11

PalettesPalettes

1-dimensional array of color values1-dimensional array of color values– Color mapColor map– Index mapIndex map– Color tableColor table– Look-up tableLook-up table

Bitmap data in a file stored as Bitmap data in a file stored as series of index valuesseries of index values– Pseudo-color storagePseudo-color storage

Graphics File Formats 12

PalettesPalettes

Can easily change, say, all red Can easily change, say, all red pixels to greenpixels to green

Graphics File Formats 13

PalettesPalettes

Palette elementPalette element– 24 or 32 bits24 or 32 bits

(0,0,0)(0,0,0)

(255,255,255)(255,255,255)

(255,0,0)(255,0,0)

(0,255,0)(0,255,0)

(0,0,255)(0,0,255)

(255,255,0)(255,255,0)

(0,255,255)(0,255,255)

(255,0,255)(255,0,255)

(128,0,0)(128,0,0)

(0,128,0)(0,128,0)

(0,0,128)(0,0,128)

(128,128,0)(128,128,0)

(0,128,128)(0,128,128)

(128,0,128)(128,0,128)

(128,128,128)(128,128,128)

(255,128,128)(255,128,128)

Graphics File Formats 14

PalettesPalettes

320 320 200 image with 3 bytes of 200 image with 3 bytes of color information per pixel and up color information per pixel and up to 256 colorsto 256 colors– Image without palette would take Image without palette would take

320*200*3 bytes of storage, or 320*200*3 bytes of storage, or 192,000 bytes192,000 bytes

Graphics File Formats 15

PalettesPalettes

320 320 200 image with 3 bytes of 200 image with 3 bytes of color information per pixel and up to color information per pixel and up to 256 colors256 colors– Image with 1 byte palette would take Image with 1 byte palette would take

320*200*1 + 256*3 (length of palette) 320*200*1 + 256*3 (length of palette) bytes of storage, or 64,768 bytesbytes of storage, or 64,768 bytes

– For small amounts of data, palette length For small amounts of data, palette length could outweigh savings in color encodingcould outweigh savings in color encoding

Graphics File Formats 16

Color SpacesColor Spaces

Composite colors are defined by Composite colors are defined by specifying three values for specifying three values for amounts of amounts of fundamental colors, fundamental colors, or or color channelscolor channels

Color is a point in Color is a point in color spacecolor space

Graphics File Formats 17

Color SpacesColor Spaces

RGBRGB– Red, green, and blueRed, green, and blue– (R,G,B)(R,G,B)

(0%, 0%, 0%) is black(0%, 0%, 0%) is black

(100%, 100%, 100%) is white(100%, 100%, 100%) is white

(50%, 50%, 50%) is light gray(50%, 50%, 50%) is light gray

(100%, 0%, 0%) is red(100%, 0%, 0%) is red

(0%, 100%, 0%) is green(0%, 100%, 0%) is green

(0%, 0%, 100%) is blue(0%, 0%, 100%) is blue

Graphics File Formats 18

Color SpacesColor Spaces

RGBRGB– 24 bit RGB24 bit RGB

Range is 0-255Range is 0-255

(0, 0, 0) is black(0, 0, 0) is black

(255, 255, 255) is white(255, 255, 255) is white

(127, 127, 127) is light gray(127, 127, 127) is light gray

(255, 0, 0) is red(255, 0, 0) is red

(0, 255, 0) is green(0, 255, 0) is green

(0, 0, 255) is blue(0, 0, 255) is blue

Graphics File Formats 19

Color SpacesColor Spaces

TruecolorTruecolor– Human eye can distinguish 2Human eye can distinguish 224 24 colorscolors– Device equal to or exceeding this is Device equal to or exceeding this is

said to display said to display truecolortruecolor– No palette neededNo palette needed

First byte is R, second byte is G, third First byte is R, second byte is G, third byte is B byte is B

Graphics File Formats 20

Color SystemsColor Systems

Additive color systemsAdditive color systems– Adding colors to black creates new colorsAdding colors to black creates new colors– The more colors that are added, the The more colors that are added, the

closer to white we getcloser to white we get– Presence of all colors creates white, Presence of all colors creates white,

while absence of all colors creates blackwhile absence of all colors creates black– Additive color environments are self-Additive color environments are self-

luminousluminous Color on monitorsColor on monitors

Graphics File Formats 21

Color SystemsColor Systems

Subtractive color systemsSubtractive color systems– Primary colors subtracted (absorbed) from Primary colors subtracted (absorbed) from

white to create new colors (reflected)white to create new colors (reflected)– The more colors that are subtracted, the The more colors that are subtracted, the

closer to black we getcloser to black we get– Presence of all primary colors creates Presence of all primary colors creates

black, while absence of all primary colors black, while absence of all primary colors creates whitecreates white

– Subtractive color environments are Subtractive color environments are reflectivereflective Color on paperColor on paper

Graphics File Formats 22

Color SystemsColor Systems

RGBRGB– AdditiveAdditive– Most widely usedMost widely used– For graphics monitorsFor graphics monitors

Graphics File Formats 23

Color SystemsColor Systems

CMYCMY– Cyan-Magenta-YellowCyan-Magenta-Yellow– SubtractiveSubtractive– Used by most laser and ink-jet printersUsed by most laser and ink-jet printers– CMYKCMYK

K stands for black, which is treated K stands for black, which is treated independentlyindependently

Glossy magazinesGlossy magazines– A dot of composite color is a grouping of four dots, A dot of composite color is a grouping of four dots,

each one a CMYK coloreach one a CMYK color

Graphics File Formats 24

Color SystemsColor Systems

HSVHSV– Hue-Saturation-ValueHue-Saturation-Value– HueHue

Specifies colorSpecifies color

– SaturationSaturation Called Called chromachroma Refers to amount of white in a hueRefers to amount of white in a hue

– Fully saturated hue contains no white and is pureFully saturated hue contains no white and is pure– Red hue with 50% saturation is pinkRed hue with 50% saturation is pink

Graphics File Formats 25

Color SystemsColor Systems

HSVHSV– ValueValue

Called Called brightnessbrightness How much light color emitsHow much light color emits Hue with high value is very brightHue with high value is very bright Hue with low value is blackHue with low value is black

– Color system used by paintersColor system used by painters Add white, black, and gray to pure Add white, black, and gray to pure

pigments to create tints, shades, and tonespigments to create tints, shades, and tones

Graphics File Formats 26

Color SystemsColor Systems

HSVHSV TintsTints

– A pure, fully saturated color combined with whiteA pure, fully saturated color combined with white ShadeShade

– A pure, fully saturated color combined with blackA pure, fully saturated color combined with black ToneTone

– A pure, fully saturated color combined with black A pure, fully saturated color combined with black and white (gray)and white (gray)

Saturation is the amount of white addedSaturation is the amount of white added Value is the amount of black addedValue is the amount of black added Hue is the color that is added toHue is the color that is added to

Graphics File Formats 27

Overlays and Overlays and TransparencyTransparency

Images are often overlaid on live Images are often overlaid on live video sources at rendering timevideo sources at rendering time– On TV, still images are shown next to On TV, still images are shown next to

live talking heads on the newslive talking heads on the news Normal images are opaqueNormal images are opaque To allow image overlay, some To allow image overlay, some

means must exist to specify means must exist to specify transparency of an image, an transparency of an image, an image area, or an image pixelimage area, or an image pixel

Graphics File Formats 28

Overlays and Overlays and TransparencyTransparency

Add overlay bit to image pixel valueAdd overlay bit to image pixel value– When bit is set, rendering application When bit is set, rendering application

ignores those pixel valuesignores those pixel values A rendering application can A rendering application can

selectively toggle overlay bit in all selectively toggle overlay bit in all pixel values of a given colorpixel values of a given color– Person standing in front of a contrasting, Person standing in front of a contrasting,

uniformly colored background screen of a uniformly colored background screen of a color which doesn’t appear elsewherecolor which doesn’t appear elsewhere

Graphics File Formats 29

Overlays and Overlays and TransparencyTransparency

A rendering application can A rendering application can selectively toggle overlay bit in all selectively toggle overlay bit in all pixel values of a given colorpixel values of a given color– Rendering application can toggle overlay Rendering application can toggle overlay

bits of all pixels of this background color, bits of all pixels of this background color, leaving an image of the person cut out leaving an image of the person cut out from the backgroundfrom the background

– This cut-out image can be overlaid on This cut-out image can be overlaid on any other imageany other image

– ChromakeyingChromakeying 256 levels of transparency256 levels of transparency

Graphics File Formats 30

Bitmap FilesBitmap Files

Image data + header informationImage data + header information– Raw format filesRaw format files

Just image dataJust image data

OrganizationOrganization– HeaderHeader

Bitmap dataBitmap data

Graphics File Formats 31

Bitmap FilesBitmap Files

OrganizationOrganization– HeaderHeader

Bitmap dataBitmap data

FooterFooter– HeaderHeader

PalettePalette

Bitmap dataBitmap data

FooterFooter

Graphics File Formats 32

Bitmap FilesBitmap Files OrganizationOrganization

HeaderHeaderBitmap dataBitmap dataPalettePalette

HeaderHeaderPalettePaletteScan line tableScan line tableColor correction table (here)Color correction table (here)Bitmap dataBitmap dataColor correction table (or here)Color correction table (or here)FooterFooter

Graphics File Formats 33

Bitmap FilesBitmap Files

OrganizationOrganization– HeaderHeader

PalettePalette

Bitmap indexBitmap index

Bitmap 1 dataBitmap 1 data

……

Bitmap N dataBitmap N data

FooterFooter

Graphics File Formats 34

Bitmap FilesBitmap Files

OrganizationOrganization– HeaderHeader

PalettePalette

Bitmap indexBitmap index

Palette 1Palette 1

Bitmap 1 dataBitmap 1 data

Palette 2Palette 2

Bitmap 2 dataBitmap 2 data

……

Palette NPalette N

Bitmap N dataBitmap N data

FooterFooter

Graphics File Formats 35

Bitmap FilesBitmap Files

HeaderHeader– Binary or ASCII dataBinary or ASCII data– Composed of fixed fieldsComposed of fixed fields– Format of header variesFormat of header varies– Types of fieldsTypes of fields

File identifierFile identifier File versionFile version Number of lines per imageNumber of lines per image Number of pixels per lineNumber of pixels per line

Graphics File Formats 36

Bitmap FilesBitmap Files

HeaderHeader– Types of fieldsTypes of fields

Number of bits per pixelNumber of bits per pixel Number of color planesNumber of color planes Compression typeCompression type X-origin of imageX-origin of image Y-origin of imageY-origin of image Text descriptionText description Unused spaceUnused space

Graphics File Formats 37

BitmapBitmap

HeaderHeader– File identifierFile identifier

Unique identifier which identifies the formatUnique identifier which identifies the format– GIFGIF

– File versionFile version For GIF, ‘87a’ or ‘89a’For GIF, ‘87a’ or ‘89a’

– Number of lines per imageNumber of lines per image Image lengthImage length Image heightImage height Number of scan linesNumber of scan lines

Graphics File Formats 38

BitmapBitmap

HeaderHeader– Number of pixels per lineNumber of pixels per line

Image widthImage width Scan line widthScan line width

– Number of bits per pixelNumber of bits per pixel Per color planePer color plane Number of bytes per pixel is Number of bytes per pixel is pixel depthpixel depth

– X and Y originsX and Y origins Indicates where image lies on output deviceIndicates where image lies on output device

Graphics File Formats 39

Color Correction TableColor Correction Table

Information to help rendering Information to help rendering application in displaying an image application in displaying an image on a device different from the one on a device different from the one assumed by the creator applicationassumed by the creator application

Graphics File Formats 40

Scan-Line TableScan-Line Table

An array of offset values used to An array of offset values used to index the location of each scan lineindex the location of each scan line

Each offset value indicates the Each offset value indicates the starting position of each scan linestarting position of each scan line