SlideShare a Scribd company logo
23
WEB IMAGE BASICS
OVERVIEW
• Where to get images
• PNG, JPEG, GIF, and WebP
• Image and screen resolution
• Web image production strategy
• Favicon
Image Sources
Create your own
Generate your own photos, illustrations, patterns, and textures. PRO: You
own rights to use the images however you’d like.
Stock photos and illustrations
• Rights-managed images must be licensed from the copyright holder
for a particular use for a particular amount of time. May be expensive.
• Royalty-free images are generally available for a fixed fee, but other
people might be using the same image.
Clip art and icons
Collections of royalty-free illustrations usually available at a modest price
Hire a designer
If you have more money than time and creative skills, consider hiring a
designer to create custom imagery.
Web Image Formats
Choose the most appropriate file format for an image to keep its file
size at a minimum:
• JPEG
• PNG
• GIF
• WebP (not yet widely supported)
NOTE: SVG is another popular web image format, but it is vector-based
and covered separately in Chapter 25.
JPEG Format
JPEG (Joint Photographic Experts Group) format is the best
format for photographs or images with smooth color transitions.
JPEG Format (cont’d)
• JPEG is a 24-bit RGB format, capable of millions of pixel colors.
• It uses a lossy compression that throws out image data to
reduce the file size. At high compression levels, you may see
blocky artifacts and loss of quality.
• Progressive JPEGs display in a series of passes that display
more quickly and may have a smaller file size.
PNG Format
The PNG (Portable Network Graphics) file format can store
several image types:
• 8-bit indexed color: Best for web pages. A maximum of
256 pixel colors resulting in very small file sizes
• 24-bit color: Millions of colors, like JPEG
• 48-bit color: Useful for high-quality storage (not appropriate
for the web)
• 16-bit grayscale: Useful for image storage (not appropriate
for the web)
PNG Format (cont’d)
• PNG uses a lossless compression, with no data thrown
away.
• They can have binary transparency (on/off) transparency or
alpha transparency (multiple level).
• Progressive display PNGs display in a series of seven
passes.
• PNGs can store gamma correction (brightness) information,
color profile information, and embedded text (such as
copyright information), although that adds to the file size and is
not very useful.
24-bit PNG (PNG-24)
• 24-bit PNG (PNG-24) is an RGB format capable of storing millions
of colors (Truecolor space).
• Because it is lossless, a PNG-24 will always be much larger than a
JPEG of the same image.
• PNG-24 uses alpha-layer transparency in which
pixels may have multiple levels of transparency
so they can blend in with the background.
NOTE: PNG-24 is used primarily for the transparency
feature despite large file sizes. There are now tools that
can convert them to smaller PNG-8 while maintaining
multiple levels of transparency.
8-bit Indexed PNG (PNG-8)
8-bit PNG (PNG-8) format is best for images with flat colors and
hard edges and images with transparent areas.
8-bit Indexed Color
8-bit means the image can store up to 256 colors (28=256) at a time.
Indexed color means that the colors in the image (its palette) are
stored in an index (also called a color table). Each color in an image
has a numerical reference that calls the pixel color from the table.
8-bit Indexed Color (cont’d)
You can see the color table for an image when you convert it to
indexed color in an image editing program.
PNG-8 Transparency
PNG-8 supports two kinds of transparency:
Binary transparency
Pixels are either entirely transparent or entirely
opaque. Transparency is stored in one slot in the
color table.
Alpha-palette transparency
Multiple transparency levels are stored in slots in
the color table. You can create PNG8+alpha files
in Adobe Photoshop or convert PNG-24 files with
the ImageAlpha utility.
NOTE: Transparency is covered in Chapter 24.
GIF Format
GIF (Graphical Interchange Format) was the first image format
for the web:
• It is good for images with flat colors and hard edges.
• It is an 8-bit indexed color format (up to 256 pixel colors).
• GIF compression is lossless (although colors are lost when
converting from RGB to indexed color).
• It uses binary transparency.
• It can store multiple frames for GIF animation.
WebP Format
WebP is a new image format from Google:
• Can use either lossless or lossy compression scheme
• Uses alpha transparency with either compression scheme
• Can be animated
• Stores metadata such as color profile information
• Bad news: Only supported in Chrome, Android, Opera,
Vivaldi, and Samsung browsers (for now)
Choosing an Image Format
If your image... use... because...
Is graphical, with flat colors 8-bit PNG or GIF PNG and GIF excel at compressing flat color.
Is a photograph or contains
graduated color
JPEG JPEG compression works best on images with blended colors.
Because it is lossy, it generally results in smaller file sizes than 24-bit
PNG.
Is a combination of flat and
photographic imagery
8-bit PNG or GIF Indexed color formats are best at preserving and compressing flat color
areas. The pixelation (dithering) that appears in the photographic areas
as a result of reducing to a palette is usually not problematic.
Requires transparency GIF or PNG-8 Both GIF and PNG allow on/off transparency in images.
Requires multiple levels of
transparency
PNG-24 or PNG-8 Only PNG supports multiple levels of transparency. PNG-24s with
alpha transparency have a much larger file size, but finding tools to
create them is easier. WebP also supports alpha transparency and
may be a better option once it is better supported.
Requires animation GIF GIF is the only supported format that can contain animation frames.
APNG and WebP may be better options in the future.
Image Size and Resolution
Bitmapped images (also called raster images) are made up of a
grid of pixels (tiny, single-colored squares):
The resolution of an image is a measurement of the number of
pixels per inch (ppi).
Image Size and Resolution (cont’d)
Display size of the image is dependent on the resolution of the
screen. In digital media, the number of pixels is important, not the
ppi at which it is created.
That said, the common practice is to create images at 72ppi in
bitmap image editors (like Photoshop).
Screen Resolution
Screen displays are made up of pixels (device pixels) which can
be measured in ppi as well (screen pixel density):
• Standard desktop monitors: 109 to 160ppi
• Apple Retina display (introduced in 2010) doubled the number
of device pixels per inch (2x display).
• Now there are 1.5x, 2x, 3x, and 4x pixel densities, allowing for
much sharper images.
Screen Resolution (cont’d)
• Before high-density displays, pixels in images and CSS
measurements mapped 1-to-1 with device pixels.
• Now that device pixels are so small, 1-to-1 mapping won’t work.
• Devices use a measurement called a reference pixel for the
purposes of layout.
• Pixels in images and CSS measurements are mapped to the
reference pixels on the device.
Screen Resolution (cont’d)
To make an image sharp on a high-density display, create it at a
larger scale, then size it down to the preferred layout size with
CSS:
Screen Resolution (cont’d)
• Most images can be created at the layout dimensions.
Example: 150 pixel wide image for a 150 pixel wide space in the
layout
• For important images (banner images, product shots), create
several versions at larger scales (2x, 3x, 4x).
Example: 300px, 450px, and 600px for 150px space
• Use responsive image markup to deliver the appropriate size for
the device.
Example:
<img src="/images/product-150px.jpg" alt=""
srcset="/images/product-300px.jpg 2x,
/images/product-450px.jpg 3x,
/images/product-600px.jpg 4x" >
Image Asset Strategy
Priorities to keep in mind when creating and adding images:
• Keep file sizes of images as small as possible.
• Minimize the number of HTTP requests to the server.
• Don’t download more image data than is needed for devices
with smaller screens.
• Deliver high-quality images to high-density displays.
Questions to Ask During
Image Production
• Can the effect be handled by CSS alone (no image)?
• Can the image be an SVG?
• If not, what is the most appropriate bitmapped format?
• Do you need multiple versions of images for responsive
layouts or high-density displays?
• Do you have a lot of images?
"Can it be done with CSS?"
Some graphical effects that once required images can now be
generated with CSS alone:
• Gradients
• Rounded corners
• Simple geometric shapes
CSS-generated shapes by Chris Coyier
“Can it be an SVG?”
SVG images usually have a smaller file size because they are
made of vectors (mathematically defined shapes), not pixels:
“Can it be an SVG?” (cont’d)
If the image is a logo, icon, or other flat illustration, saving it as an
SVG offers a number of advantages:
• Smaller file size
• Resizing without loss of quality (great for responsive layouts)
• No HTTP request if the code is placed inline in the HTML
source
NOTE: For photographic image types or for sites where you know your
audience uses non-supporting browsers, you will need to use an
alternative format.
“What is the best bitmapped format?”
Saving an image in the most appropriate format has a big impact
on file size.
General guidelines:
• JPEG is the best format for photographic images or images
with smooth gradations of color.
• PNG-8 is the best option for images with flat colors and
hard edges.
• WebP may result in even smaller images, but it needs to be
added to the page with the picture element with fallbacks.
“Does the layout require
responsive images?”
NO:
If one size is fine, choose the most appropriate file format and
optimize the image.
YES:
• Save in the flexible SVG format if possible.
• Take advantage of image tool features that output an image at
different scales.
• Use responsive image markup to be sure devices don’t
download more data than necessary.
“Does the site have a lot of images?”
If you have more images and responsive markup than you can
produce manually, consider an image automation system on
the server.
You upload one high-quality image, and the server software
creates multiple versions and delivers them appropriately.
Some image automation options:
• Services built into your content management system
• Cloudinary.com
• Akamai.com
Favicons
A favicon is the little icon that appears next to the page title in
the browser tab and bookmark lists:
Favicons help users identify your site and can strengthen your
brand.
Creating Favicons
For desktop browsers (and the only method supported by IE10 and
earlier), follow these steps:
• Save your icon in ICO format and name it favicon.ico:
• Use a conversion tool such as icoconverter.com.
• Create both 16x16 and 32x32 pixel versions and store them in
one .ico file.
• Put the favicon.ico file in the root directory of the site with
index.html. Browsers know where to look for it.
Full Favicon Set
• Other devices use favicon-like icons to represent sites.
• They can be saved in PNG format and may include transparency.
• Add them to the HTML page using the link element in the head
of the document (this example for iPhone with Retina screen):
<link rel="apple-touch-icon-precomposed" sizes="120x120"
href="apple-touch-icon-120x120.png">
(The rel value prevents iOS from adding shadows and reflective effects.)
NOTE: For a complete list of icon sizes for various devices and operating
systems, see Table 23-2 in the book.
Creating Favicon Sets
Make icons by hand
Start with an SVG original if possible. Make manual
adjustments to fix quality of icons under 32x32px.
or
Use a favicon generator
www.favicomatic.com outputs multiple icons from your original
as well as the necessary code. Other similar tools are
available.

More Related Content

Similar to Chapter 23: Web Images

Creating Images for the Web
Creating Images for the WebCreating Images for the Web
Creating Images for the WebShawn Calvert
 
Castro Chapter 5
Castro Chapter 5Castro Chapter 5
Castro Chapter 5Jeff Byrnes
 
Photoshop graphic intro ppt by kartik mandothiya
Photoshop graphic intro ppt by kartik mandothiyaPhotoshop graphic intro ppt by kartik mandothiya
Photoshop graphic intro ppt by kartik mandothiyaKartik Mandothiya
 
Types of Images & File Types
Types of Images & File TypesTypes of Images & File Types
Types of Images & File TypesChris Chapman
 
9781111528705_PPT_ch08.ppt
9781111528705_PPT_ch08.ppt9781111528705_PPT_ch08.ppt
9781111528705_PPT_ch08.pptSimonChirambira
 
Image file formats
Image file formatsImage file formats
Image file formatsKarlRubin
 
12.m3 cms content-updating-pt1
12.m3 cms content-updating-pt112.m3 cms content-updating-pt1
12.m3 cms content-updating-pt1tarensi
 
Stem 71 24 multimedia elements - graphics
Stem 71 24   multimedia elements - graphicsStem 71 24   multimedia elements - graphics
Stem 71 24 multimedia elements - graphicsKelly Bauer
 
Week 6 Task File Formats
Week 6 Task   File FormatsWeek 6 Task   File Formats
Week 6 Task File Formatsguest2cf876
 

Similar to Chapter 23: Web Images (20)

Creating Images for the Web
Creating Images for the WebCreating Images for the Web
Creating Images for the Web
 
P1.1
P1.1P1.1
P1.1
 
Castro Chapter 5
Castro Chapter 5Castro Chapter 5
Castro Chapter 5
 
Artdm171 Week6 Images
Artdm171 Week6 ImagesArtdm171 Week6 Images
Artdm171 Week6 Images
 
Photoshop graphic intro ppt by kartik mandothiya
Photoshop graphic intro ppt by kartik mandothiyaPhotoshop graphic intro ppt by kartik mandothiya
Photoshop graphic intro ppt by kartik mandothiya
 
Types of Images & File Types
Types of Images & File TypesTypes of Images & File Types
Types of Images & File Types
 
Graphics
GraphicsGraphics
Graphics
 
Ppt ch08
Ppt ch08Ppt ch08
Ppt ch08
 
Ppt ch08
Ppt ch08Ppt ch08
Ppt ch08
 
Graphics and imagea
Graphics and imageaGraphics and imagea
Graphics and imagea
 
MM1
MM1MM1
MM1
 
9781111528705_PPT_ch08.ppt
9781111528705_PPT_ch08.ppt9781111528705_PPT_ch08.ppt
9781111528705_PPT_ch08.ppt
 
Lab#2 illustrator
Lab#2 illustratorLab#2 illustrator
Lab#2 illustrator
 
Image file formats
Image file formatsImage file formats
Image file formats
 
Chapter13
Chapter13Chapter13
Chapter13
 
12.m3 cms content-updating-pt1
12.m3 cms content-updating-pt112.m3 cms content-updating-pt1
12.m3 cms content-updating-pt1
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Technical File
Technical FileTechnical File
Technical File
 
Stem 71 24 multimedia elements - graphics
Stem 71 24   multimedia elements - graphicsStem 71 24   multimedia elements - graphics
Stem 71 24 multimedia elements - graphics
 
Week 6 Task File Formats
Week 6 Task   File FormatsWeek 6 Task   File Formats
Week 6 Task File Formats
 

More from Steve Guinan

Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationSteve Guinan
 
Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Steve Guinan
 
Chapter 14: Box Model
Chapter 14: Box ModelChapter 14: Box Model
Chapter 14: Box ModelSteve Guinan
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsSteve Guinan
 
Chapter 12: CSS Part 2
Chapter 12: CSS Part 2Chapter 12: CSS Part 2
Chapter 12: CSS Part 2Steve Guinan
 
Chapter 11: Intro to CSS
Chapter 11: Intro to CSSChapter 11: Intro to CSS
Chapter 11: Intro to CSSSteve Guinan
 
HubSpot Student Instructions
HubSpot Student InstructionsHubSpot Student Instructions
HubSpot Student InstructionsSteve Guinan
 
Ch 5: Marking up Text
Ch 5: Marking up TextCh 5: Marking up Text
Ch 5: Marking up TextSteve Guinan
 
Ch 2: How the Web Works
Ch 2: How the Web WorksCh 2: How the Web Works
Ch 2: How the Web WorksSteve Guinan
 
Ch 1: Getting Started
Ch 1: Getting StartedCh 1: Getting Started
Ch 1: Getting StartedSteve Guinan
 
Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Steve Guinan
 
Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6Steve Guinan
 
Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5Steve Guinan
 
Intro to Web Design 6e Chapter 4
Intro to Web Design 6e Chapter 4 Intro to Web Design 6e Chapter 4
Intro to Web Design 6e Chapter 4 Steve Guinan
 
Intro to Web Design 6e Chapter 3
Intro to Web Design 6e Chapter 3 Intro to Web Design 6e Chapter 3
Intro to Web Design 6e Chapter 3 Steve Guinan
 
Intro to Web Design 6e Chapter 2
Intro to Web Design 6e Chapter 2 Intro to Web Design 6e Chapter 2
Intro to Web Design 6e Chapter 2 Steve Guinan
 
Intro to Web Design 6e Chapter 1
Intro to Web Design 6e Chapter 1Intro to Web Design 6e Chapter 1
Intro to Web Design 6e Chapter 1Steve Guinan
 

More from Steve Guinan (20)

Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and Animation
 
Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
 
Chapter 8: Tables
Chapter 8: TablesChapter 8: Tables
Chapter 8: Tables
 
Chapter 14: Box Model
Chapter 14: Box ModelChapter 14: Box Model
Chapter 14: Box Model
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
 
Chapter 12: CSS Part 2
Chapter 12: CSS Part 2Chapter 12: CSS Part 2
Chapter 12: CSS Part 2
 
Chapter 11: Intro to CSS
Chapter 11: Intro to CSSChapter 11: Intro to CSS
Chapter 11: Intro to CSS
 
HubSpot Student Instructions
HubSpot Student InstructionsHubSpot Student Instructions
HubSpot Student Instructions
 
Ch 6: Links
Ch 6: LinksCh 6: Links
Ch 6: Links
 
Ch 5: Marking up Text
Ch 5: Marking up TextCh 5: Marking up Text
Ch 5: Marking up Text
 
Ch 2: How the Web Works
Ch 2: How the Web WorksCh 2: How the Web Works
Ch 2: How the Web Works
 
Ch 1: Getting Started
Ch 1: Getting StartedCh 1: Getting Started
Ch 1: Getting Started
 
Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7
 
Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6
 
Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5
 
Intro to Web Design 6e Chapter 4
Intro to Web Design 6e Chapter 4 Intro to Web Design 6e Chapter 4
Intro to Web Design 6e Chapter 4
 
Intro to Web Design 6e Chapter 3
Intro to Web Design 6e Chapter 3 Intro to Web Design 6e Chapter 3
Intro to Web Design 6e Chapter 3
 
Intro to Web Design 6e Chapter 2
Intro to Web Design 6e Chapter 2 Intro to Web Design 6e Chapter 2
Intro to Web Design 6e Chapter 2
 
Intro to Web Design 6e Chapter 1
Intro to Web Design 6e Chapter 1Intro to Web Design 6e Chapter 1
Intro to Web Design 6e Chapter 1
 

Recently uploaded

ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEHimani415946
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxGal Baras
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesSanjeev Rampal
 
Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?Linksys Velop Login
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyDamar Juniarto
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shoplaozhuseo02
 
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理aagad
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxabhinandnam9997
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxlaozhuseo02
 
The AI Powered Organization-Intro to AI-LAN.pdf
The AI Powered Organization-Intro to AI-LAN.pdfThe AI Powered Organization-Intro to AI-LAN.pdf
The AI Powered Organization-Intro to AI-LAN.pdfSiskaFitrianingrum
 

Recently uploaded (12)

The Best AI Powered Software - Intellivid AI Studio
The Best AI Powered Software - Intellivid AI StudioThe Best AI Powered Software - Intellivid AI Studio
The Best AI Powered Software - Intellivid AI Studio
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdf
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case Study
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptx
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
The AI Powered Organization-Intro to AI-LAN.pdf
The AI Powered Organization-Intro to AI-LAN.pdfThe AI Powered Organization-Intro to AI-LAN.pdf
The AI Powered Organization-Intro to AI-LAN.pdf
 

Chapter 23: Web Images

  • 2. OVERVIEW • Where to get images • PNG, JPEG, GIF, and WebP • Image and screen resolution • Web image production strategy • Favicon
  • 3. Image Sources Create your own Generate your own photos, illustrations, patterns, and textures. PRO: You own rights to use the images however you’d like. Stock photos and illustrations • Rights-managed images must be licensed from the copyright holder for a particular use for a particular amount of time. May be expensive. • Royalty-free images are generally available for a fixed fee, but other people might be using the same image. Clip art and icons Collections of royalty-free illustrations usually available at a modest price Hire a designer If you have more money than time and creative skills, consider hiring a designer to create custom imagery.
  • 4. Web Image Formats Choose the most appropriate file format for an image to keep its file size at a minimum: • JPEG • PNG • GIF • WebP (not yet widely supported) NOTE: SVG is another popular web image format, but it is vector-based and covered separately in Chapter 25.
  • 5. JPEG Format JPEG (Joint Photographic Experts Group) format is the best format for photographs or images with smooth color transitions.
  • 6. JPEG Format (cont’d) • JPEG is a 24-bit RGB format, capable of millions of pixel colors. • It uses a lossy compression that throws out image data to reduce the file size. At high compression levels, you may see blocky artifacts and loss of quality. • Progressive JPEGs display in a series of passes that display more quickly and may have a smaller file size.
  • 7. PNG Format The PNG (Portable Network Graphics) file format can store several image types: • 8-bit indexed color: Best for web pages. A maximum of 256 pixel colors resulting in very small file sizes • 24-bit color: Millions of colors, like JPEG • 48-bit color: Useful for high-quality storage (not appropriate for the web) • 16-bit grayscale: Useful for image storage (not appropriate for the web)
  • 8. PNG Format (cont’d) • PNG uses a lossless compression, with no data thrown away. • They can have binary transparency (on/off) transparency or alpha transparency (multiple level). • Progressive display PNGs display in a series of seven passes. • PNGs can store gamma correction (brightness) information, color profile information, and embedded text (such as copyright information), although that adds to the file size and is not very useful.
  • 9. 24-bit PNG (PNG-24) • 24-bit PNG (PNG-24) is an RGB format capable of storing millions of colors (Truecolor space). • Because it is lossless, a PNG-24 will always be much larger than a JPEG of the same image. • PNG-24 uses alpha-layer transparency in which pixels may have multiple levels of transparency so they can blend in with the background. NOTE: PNG-24 is used primarily for the transparency feature despite large file sizes. There are now tools that can convert them to smaller PNG-8 while maintaining multiple levels of transparency.
  • 10. 8-bit Indexed PNG (PNG-8) 8-bit PNG (PNG-8) format is best for images with flat colors and hard edges and images with transparent areas.
  • 11. 8-bit Indexed Color 8-bit means the image can store up to 256 colors (28=256) at a time. Indexed color means that the colors in the image (its palette) are stored in an index (also called a color table). Each color in an image has a numerical reference that calls the pixel color from the table.
  • 12. 8-bit Indexed Color (cont’d) You can see the color table for an image when you convert it to indexed color in an image editing program.
  • 13. PNG-8 Transparency PNG-8 supports two kinds of transparency: Binary transparency Pixels are either entirely transparent or entirely opaque. Transparency is stored in one slot in the color table. Alpha-palette transparency Multiple transparency levels are stored in slots in the color table. You can create PNG8+alpha files in Adobe Photoshop or convert PNG-24 files with the ImageAlpha utility. NOTE: Transparency is covered in Chapter 24.
  • 14. GIF Format GIF (Graphical Interchange Format) was the first image format for the web: • It is good for images with flat colors and hard edges. • It is an 8-bit indexed color format (up to 256 pixel colors). • GIF compression is lossless (although colors are lost when converting from RGB to indexed color). • It uses binary transparency. • It can store multiple frames for GIF animation.
  • 15. WebP Format WebP is a new image format from Google: • Can use either lossless or lossy compression scheme • Uses alpha transparency with either compression scheme • Can be animated • Stores metadata such as color profile information • Bad news: Only supported in Chrome, Android, Opera, Vivaldi, and Samsung browsers (for now)
  • 16. Choosing an Image Format If your image... use... because... Is graphical, with flat colors 8-bit PNG or GIF PNG and GIF excel at compressing flat color. Is a photograph or contains graduated color JPEG JPEG compression works best on images with blended colors. Because it is lossy, it generally results in smaller file sizes than 24-bit PNG. Is a combination of flat and photographic imagery 8-bit PNG or GIF Indexed color formats are best at preserving and compressing flat color areas. The pixelation (dithering) that appears in the photographic areas as a result of reducing to a palette is usually not problematic. Requires transparency GIF or PNG-8 Both GIF and PNG allow on/off transparency in images. Requires multiple levels of transparency PNG-24 or PNG-8 Only PNG supports multiple levels of transparency. PNG-24s with alpha transparency have a much larger file size, but finding tools to create them is easier. WebP also supports alpha transparency and may be a better option once it is better supported. Requires animation GIF GIF is the only supported format that can contain animation frames. APNG and WebP may be better options in the future.
  • 17. Image Size and Resolution Bitmapped images (also called raster images) are made up of a grid of pixels (tiny, single-colored squares): The resolution of an image is a measurement of the number of pixels per inch (ppi).
  • 18. Image Size and Resolution (cont’d) Display size of the image is dependent on the resolution of the screen. In digital media, the number of pixels is important, not the ppi at which it is created. That said, the common practice is to create images at 72ppi in bitmap image editors (like Photoshop).
  • 19. Screen Resolution Screen displays are made up of pixels (device pixels) which can be measured in ppi as well (screen pixel density): • Standard desktop monitors: 109 to 160ppi • Apple Retina display (introduced in 2010) doubled the number of device pixels per inch (2x display). • Now there are 1.5x, 2x, 3x, and 4x pixel densities, allowing for much sharper images.
  • 20. Screen Resolution (cont’d) • Before high-density displays, pixels in images and CSS measurements mapped 1-to-1 with device pixels. • Now that device pixels are so small, 1-to-1 mapping won’t work. • Devices use a measurement called a reference pixel for the purposes of layout. • Pixels in images and CSS measurements are mapped to the reference pixels on the device.
  • 21. Screen Resolution (cont’d) To make an image sharp on a high-density display, create it at a larger scale, then size it down to the preferred layout size with CSS:
  • 22. Screen Resolution (cont’d) • Most images can be created at the layout dimensions. Example: 150 pixel wide image for a 150 pixel wide space in the layout • For important images (banner images, product shots), create several versions at larger scales (2x, 3x, 4x). Example: 300px, 450px, and 600px for 150px space • Use responsive image markup to deliver the appropriate size for the device. Example: <img src="/images/product-150px.jpg" alt="" srcset="/images/product-300px.jpg 2x, /images/product-450px.jpg 3x, /images/product-600px.jpg 4x" >
  • 23. Image Asset Strategy Priorities to keep in mind when creating and adding images: • Keep file sizes of images as small as possible. • Minimize the number of HTTP requests to the server. • Don’t download more image data than is needed for devices with smaller screens. • Deliver high-quality images to high-density displays.
  • 24. Questions to Ask During Image Production • Can the effect be handled by CSS alone (no image)? • Can the image be an SVG? • If not, what is the most appropriate bitmapped format? • Do you need multiple versions of images for responsive layouts or high-density displays? • Do you have a lot of images?
  • 25. "Can it be done with CSS?" Some graphical effects that once required images can now be generated with CSS alone: • Gradients • Rounded corners • Simple geometric shapes CSS-generated shapes by Chris Coyier
  • 26. “Can it be an SVG?” SVG images usually have a smaller file size because they are made of vectors (mathematically defined shapes), not pixels:
  • 27. “Can it be an SVG?” (cont’d) If the image is a logo, icon, or other flat illustration, saving it as an SVG offers a number of advantages: • Smaller file size • Resizing without loss of quality (great for responsive layouts) • No HTTP request if the code is placed inline in the HTML source NOTE: For photographic image types or for sites where you know your audience uses non-supporting browsers, you will need to use an alternative format.
  • 28. “What is the best bitmapped format?” Saving an image in the most appropriate format has a big impact on file size. General guidelines: • JPEG is the best format for photographic images or images with smooth gradations of color. • PNG-8 is the best option for images with flat colors and hard edges. • WebP may result in even smaller images, but it needs to be added to the page with the picture element with fallbacks.
  • 29. “Does the layout require responsive images?” NO: If one size is fine, choose the most appropriate file format and optimize the image. YES: • Save in the flexible SVG format if possible. • Take advantage of image tool features that output an image at different scales. • Use responsive image markup to be sure devices don’t download more data than necessary.
  • 30. “Does the site have a lot of images?” If you have more images and responsive markup than you can produce manually, consider an image automation system on the server. You upload one high-quality image, and the server software creates multiple versions and delivers them appropriately. Some image automation options: • Services built into your content management system • Cloudinary.com • Akamai.com
  • 31. Favicons A favicon is the little icon that appears next to the page title in the browser tab and bookmark lists: Favicons help users identify your site and can strengthen your brand.
  • 32. Creating Favicons For desktop browsers (and the only method supported by IE10 and earlier), follow these steps: • Save your icon in ICO format and name it favicon.ico: • Use a conversion tool such as icoconverter.com. • Create both 16x16 and 32x32 pixel versions and store them in one .ico file. • Put the favicon.ico file in the root directory of the site with index.html. Browsers know where to look for it.
  • 33. Full Favicon Set • Other devices use favicon-like icons to represent sites. • They can be saved in PNG format and may include transparency. • Add them to the HTML page using the link element in the head of the document (this example for iPhone with Retina screen): <link rel="apple-touch-icon-precomposed" sizes="120x120" href="apple-touch-icon-120x120.png"> (The rel value prevents iOS from adding shadows and reflective effects.) NOTE: For a complete list of icon sizes for various devices and operating systems, see Table 23-2 in the book.
  • 34. Creating Favicon Sets Make icons by hand Start with an SVG original if possible. Make manual adjustments to fix quality of icons under 32x32px. or Use a favicon generator www.favicomatic.com outputs multiple icons from your original as well as the necessary code. Other similar tools are available.