Presentation is loading. Please wait.

Presentation is loading. Please wait.

Design Concepts: Module B: Creating Images. Goals Understand how what dithering and gamma areUnderstand how what dithering and gamma are Understand how.

Similar presentations


Presentation on theme: "Design Concepts: Module B: Creating Images. Goals Understand how what dithering and gamma areUnderstand how what dithering and gamma are Understand how."— Presentation transcript:

1 Design Concepts: Module B: Creating Images

2 Goals Understand how what dithering and gamma areUnderstand how what dithering and gamma are Understand how image compression worksUnderstand how image compression works Understand how to add images to your web pagesUnderstand how to add images to your web pages

3 Dithering Typically, modern monitors can display 24-bit, “True Color”Typically, modern monitors can display 24-bit, “True Color” However, there are other monitors which don’t have “True Color” capabilitiesHowever, there are other monitors which don’t have “True Color” capabilities

4 Dithering As a result, 24-bit colors which are not recognized by less powerful displays are approximated.As a result, 24-bit colors which are not recognized by less powerful displays are approximated. The approximation can result in a speckled look called ditheringThe approximation can result in a speckled look called dithering Solution? The “Web Palette”Solution? The “Web Palette”

5 The Web Palette 216 “Web safe” colors216 “Web safe” colors Cross-section of Windows and Macintosh color palettesCross-section of Windows and Macintosh color palettes Colors look generally the same for all usersColors look generally the same for all users AKA – “Netscape Colors” or “Web Safe Palette”AKA – “Netscape Colors” or “Web Safe Palette”

6 Gamma Gamma can be thought of as the “brightness” of a monitorGamma can be thought of as the “brightness” of a monitor Windows & Unix displays tend to darker than Macintosh displaysWindows & Unix displays tend to darker than Macintosh displays

7 Gamma Result? Images created on a Windows machine may look “washed-out” on a Mac; Images created on a Mac may look too dark on a Windows machineResult? Images created on a Windows machine may look “washed-out” on a Mac; Images created on a Mac may look too dark on a Windows machine Lesson? Test your images across platforms or, at the very least, check for gamma using a gamma correction toolLesson? Test your images across platforms or, at the very least, check for gamma using a gamma correction tool

8 Displaying Color as Images Analog images are continuous representations of colorAnalog images are continuous representations of color This is somewhat of a problem for computers, which like discrete measurementsThis is somewhat of a problem for computers, which like discrete measurements

9 Displaying Color as Images The analog signal representing a continuous image is sampled to produce discrete values which can be stored by a computerThe analog signal representing a continuous image is sampled to produce discrete values which can be stored by a computer The frequency of digital samples greatly affects the quality of the digital imageThe frequency of digital samples greatly affects the quality of the digital image

10 How Sampling Works The original analog representation Measurements are made at equal intervals Discrete samples are taken from the measurements

11 The Pixel Sample location and sample values combine to make the picture element or pixelSample location and sample values combine to make the picture element or pixel 3 color samples per pixel:3 color samples per pixel: –1 RED sample –1 GREEN sample –1 BLUE sample

12 The Pixel Information about pixels is stored in a rectangular pattern and displayed to the screen in rows called rasters (from Spalter).Information about pixels is stored in a rectangular pattern and displayed to the screen in rows called rasters (from Spalter).

13 The Pixel (continued) Monitor pixels are actually circular light representations of red, green and blue phosphorsMonitor pixels are actually circular light representations of red, green and blue phosphors Pixel density is measured using Dots Per Inch (DPI)Pixel density is measured using Dots Per Inch (DPI)

14 The Pixel (continued) Pixel size is measured using Dot PitchPixel size is measured using Dot Pitch DPI and Dot Pitch have an inverse relationship ( DPI = Dot Pitch)DPI and Dot Pitch have an inverse relationship ( DPI = Dot Pitch)

15 Bit-Depth Number of bits to represent pixel colorNumber of bits to represent pixel color ExpressionNameColors 212121212-bit2 242424244-bit16 262626266-bit64

16 Bit-Depth ExpressionNameColors 282828288-bit256 2 16 16-bit 65, 536 2 24 24-bit (True Color) About 16-million

17 Images on the Internet There are actually two main categories of images that you might encounter on the InternetThere are actually two main categories of images that you might encounter on the Internet –Raster Graphics –Vector Graphics

18 Raster Graphics Color information is stored based on location and RGB valueColor information is stored based on location and RGB value Costs lots of disk spaceCosts lots of disk space

19 Vector Graphics Color information is stored in a series of mathematical calculationsColor information is stored in a series of mathematical calculations Don’t cost a lot of disk spaceDon’t cost a lot of disk space Fairly processor- intensiveFairly processor- intensive Image from http://www.povray.org/ http://www.povray.org/

20 Raster Image Compression An image in its raw format would be too large to transfer in a web downloadAn image in its raw format would be too large to transfer in a web download Because of this, images are generally saved using any one of several compression algorithmsBecause of this, images are generally saved using any one of several compression algorithms

21 GIF Format Graphic Interchange Format (GIF)Graphic Interchange Format (GIF) “Lossless” Compression“Lossless” Compression Originally developed by CompuServeOriginally developed by CompuServe You can reduce file size by color reduction and changing bit-depthYou can reduce file size by color reduction and changing bit-depth

22 GIF Format Uses LZW (Lempel-Zev-Welch) compressionUses LZW (Lempel-Zev-Welch) compression –Efficient at condensing color information for pixel rows of identical color –Takes advantage of large areas of “flat” color –Good for line drawings, illustrations and cartoon-like images –Patent for LZW is owned and enforced by Unisys

23 GIF Types GIF87aGIF87a –Can support up to 8-bit color (256 colors) –Supports interlacing GIF89aGIF89a –Supports everything supported by GIF87a –Also supports transparency –Also supports animation

24 GIF Types Both types have universal browser- supportBoth types have universal browser- support Both types are saved with the.GIF extensionBoth types are saved with the.GIF extension

25 GIF Format - Interlacing Normal GIFs are displayed in their entirety when the image is completed downloadedNormal GIFs are displayed in their entirety when the image is completed downloaded However, interlacing allows the image to “fade in”However, interlacing allows the image to “fade in”

26 GIF Format - Interlacing How does this happen?How does this happen? –Rows of pixels appear only after 12.5% of it has been downloaded –3 subsequent “passes” display 25%, 50% and, finally, 100% of the image Results in slightly larger file sizeResults in slightly larger file size

27 GIF Format - Transparency Transparency allows designers to display images that seem as if they weren’t bound by rectangular bordersTransparency allows designers to display images that seem as if they weren’t bound by rectangular borders

28 GIF Format - Transparency How does it happen?How does it happen? –The background of an image is set to a color that the designer chooses to be “invisible” (this color is later identified as the invisible color) –The resulting image’s background disappears and is replaced by the web page’s background

29 GIF Format - Transparency

30 JPEG Format Joint Photographic Experts Group (JPEG)Joint Photographic Experts Group (JPEG) Supports 24-bit “True Color”Supports 24-bit “True Color” Good for images with large gradations in colorGood for images with large gradations in color Must be decompressed before they are displayed in a browserMust be decompressed before they are displayed in a browser

31 JPEG Format Based on spatial frequencyBased on spatial frequency Samples image information in an 8 x 8 pixel areaSamples image information in an 8 x 8 pixel area “Lossy” Compression – image information is lost during the compression process; Lesson? Make changes to copies of your original!“Lossy” Compression – image information is lost during the compression process; Lesson? Make changes to copies of your original!

32 JPEG Format Different compression ratios can be selectedDifferent compression ratios can be selected Represent a trade-off: File Size vs. Image QualityRepresent a trade-off: File Size vs. Image Quality Determined by “Q” setting (0-100)Determined by “Q” setting (0-100)

33 JPEG “Q” Setting Lower setting is a more aggressive ratio, resulting in smaller file sizes, but lower image qualityLower setting is a more aggressive ratio, resulting in smaller file sizes, but lower image quality Higher setting is less aggressive, resulting in better quality images, but larger filesHigher setting is less aggressive, resulting in better quality images, but larger files

34 Progressive JPEGs Display in a series of passes (similar to interlaced GIFs)Display in a series of passes (similar to interlaced GIFs) Number of passes can determined when the graphic is savedNumber of passes can determined when the graphic is saved

35 Progressive JPEGs Slightly smaller file size than regular JPEGsSlightly smaller file size than regular JPEGs Require more processing power than regular JPEGsRequire more processing power than regular JPEGs Not supported by all browsersNot supported by all browsers

36 When to use JPEGs Images with large gradations in color (photos)Images with large gradations in color (photos) DO NOT USE FOR IMAGES WITH “FLAT” COLORDO NOT USE FOR IMAGES WITH “FLAT” COLOR

37 PNG Format Portable Network Graphic (PNG)Portable Network Graphic (PNG) Open source solution to GIF patent issueOpen source solution to GIF patent issue Like GIF, good at compressing images with large areas of flat colorLike GIF, good at compressing images with large areas of flat color Support of up to 24-bit colorSupport of up to 24-bit color Lossless compressionLossless compression

38 PNG Format Two dimensional progressive display (similar, but better than, GIF’s interlacing)Two dimensional progressive display (similar, but better than, GIF’s interlacing) Supports “shades” of transparency; allows for more than 1 color to be transparentSupports “shades” of transparency; allows for more than 1 color to be transparent Built-in Gamma correctionBuilt-in Gamma correction

39 PNG Format Includes text capabilities for notes such as copyright infoIncludes text capabilities for notes such as copyright info Browser support is spotty, at bestBrowser support is spotty, at best Never use for images with large color gradations (use JPEGs instead)Never use for images with large color gradations (use JPEGs instead)

40 Managing Graphics Try to design new graphics using Web-safe colorsTry to design new graphics using Web-safe colors Keep graphic dimensions small (smaller graphics result in smaller file size)Keep graphic dimensions small (smaller graphics result in smaller file size)

41 Managing Graphics Don’t attempt to reduce color color information on your own (results in dithering) -- browsers are capable of approximating nearest colorsDon’t attempt to reduce color color information on your own (results in dithering) -- browsers are capable of approximating nearest colors Use correct compression schemes appropriate for your image!Use correct compression schemes appropriate for your image!

42 The Element The src attribute specifies the filename of an image fileThe src attribute specifies the filename of an image file To include the src attribute within the element, you type img src =“mygraphic.gif”>To include the src attribute within the element, you type img src =“mygraphic.gif”>

43 The Element The element also includes other attributesThe element also includes other attributes

44 The alt Attribute For an XHTML document to be well formed, the element must include the src and alt attributesFor an XHTML document to be well formed, the element must include the src and alt attributes

45 The alt Attribute The alt attribute is very important for user agents that do not display images and Web browsers that are designed for users of Braille and speech devicesThe alt attribute is very important for user agents that do not display images and Web browsers that are designed for users of Braille and speech devices

46 The alt Attribute Alternate text will display if an image has not yet downloaded, if the user has turned off the display of images in their Web browsers, or if for some reason the image is not availableAlternate text will display if an image has not yet downloaded, if the user has turned off the display of images in their Web browsers, or if for some reason the image is not available

47 The alt Attribute The alt attribute also serves another purpose:The alt attribute also serves another purpose: –For any elements that do not include a title attribute, the value assigned to the alt attribute appears as a ToolTip in Internet Explorer and other browsers when you hold your mouse over the image

48 Height and Width When you create an element that includes only the src and alt attributes, a Web browser needs to examine the image and determine the number of pixels to reserve for itWhen you create an element that includes only the src and alt attributes, a Web browser needs to examine the image and determine the number of pixels to reserve for it

49 Height and Width However, if you use the height and width attributes to specify the size of an image, the Web browser will use their values to reserve enough space on the page for each imageHowever, if you use the height and width attributes to specify the size of an image, the Web browser will use their values to reserve enough space on the page for each image

50 Height and Width It is very important to always assign height and width attribute values that are the exact dimensions of the original imageIt is very important to always assign height and width attribute values that are the exact dimensions of the original image

51 Height and Width Do not use the height and width attributes to resize an image on your Web pageDo not use the height and width attributes to resize an image on your Web page

52 Height and Width

53 Another reason not to use the height and width attributes to modify the size of an image is that although you may reduce how the image appears in a browser, the browser still needs to download the original image in its original size, which may result in the page rendering more slowly than necessaryAnother reason not to use the height and width attributes to modify the size of an image is that although you may reduce how the image appears in a browser, the browser still needs to download the original image in its original size, which may result in the page rendering more slowly than necessary

54 Using Images from Other Locations You can place images in subfolders that are relative to the location of the current Web page folderYou can place images in subfolders that are relative to the location of the current Web page folder You can link to images at other locations on the Web by assigning an absolute URL to the src attribute of the element.You can link to images at other locations on the Web by assigning an absolute URL to the src attribute of the element.

55 Using Images from Other Locations You can see one example of linking to an image on the Web at the W3C Web page for validating XHTML documentsYou can see one example of linking to an image on the Web at the W3C Web page for validating XHTML documents

56 Resources Some slides were adapted from the following text & companion lectures:Some slides were adapted from the following text & companion lectures: XHTML, Comprehensive First Edition Dan Gosselin Published by Course Technology (2004)


Download ppt "Design Concepts: Module B: Creating Images. Goals Understand how what dithering and gamma areUnderstand how what dithering and gamma are Understand how."

Similar presentations


Ads by Google