Download presentation
Presentation is loading. Please wait.
Published byMoris Singleton Modified over 9 years ago
1
Computer Science 101 Images in Web Pages
2
Image Files Two common formats, GIF and JPEG GIF images are more flexible for use as icons JPEG images are sharper with more colors (good for full-size photos)
3
Sizes Image size - measured as width and height in pixels File size - measured as data size in kilobytes (1000 bytes = 1000 * 8 bits)
4
Data Compression For a true color monitor, each pixel gets 24 bits Even a small image size requires a huge number of bits (100 * 100 * 24 = 240K) Files are in compressed format and the image is rebuilt when it is displayed
5
Creating and Editing Images Use a scanner, a digital camera, or a digital video camera with a stop Edit with an image manipulation program
6
Image Markup Use the IMG element Not a container element One required attribute, SRC Loads the image stored at the URL
7
Example: Nathaniel
8
Too Big, Too Many The larger the image, the more time it takes to load Use economy with images on a single page Create a balance between speed and content
9
Width and Height Attributes By default, width and height come from the image itself The size of an image can be reduced or enlarged by specifying the attributes
11
Always Specify the Width and Height The browser can lay out the entire page before all the images have been loaded
12
Resizing Rectangular Images When an image is not a square, you must adjust the width and the height in proportion to the desired size We need to fit a 26 by 37 image in a square of 30 26/37 = w/30
13
Alignment ALIGN –bottom (default) –middle –top –left (causes text to flow to right of image) –right
14
Spacing HSPACE,VSPACE expect number of pixels as values
16
Other Attributes BORDER=pixelWidth, draws a border around the image ALT="some text", displays the text when the image is unavailable or the browser’s image display is turned off
17
Images as Links Use a small version of the image as a link
18
Thumbnailing You can just resize the image for the link, but it will take the same time to load as if it were the original size Better to create a thumbnail by using an image processing program to reduce the image’s file size
19
Organizing Image Files Keep them on your server (for speed) Associate with topics in their directories Or keep commonly used images in a separate directory under public_html
20
Background Images Use an image to paint a page’s background Tiles the image (repeats its display in row after row)
21
Other Contents of Web Pages In addition to text and images, Web pages can contain –video –sound –applications
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.