Adding Images and i-mode Pictograms
Using Images in i-mode
As a designer of i-mode wireless content, the handset's screen is your canvas. If you're also a desktop Web developer, you already know about the issue of screen size as something that you have to take into consideration when developing images for your Web site. You want to present graphics to users in a way that works best with the size of their screen. The same is true with i-mode images, except that now you must be even more careful with regard to image dimensions and file size.
Image File Formats
In Japan, at the time this article was written, GIF (GIF87a and GIF89) images were the only format universally available for use in i-mode pages. Some of the latest handsets can display JPEG files, so you should expect expanded support for JPEG and even PNG files as i-mode matures.
GIF files employ the LZW compression scheme to reduce the amount of information needed to completely describe the image. The LZW scheme is best suited to simple images such as line drawings or images with just a few unique colors.
Version 3 of i-mode HTML supports the following features:
- Non-interlaced GIF
- Interlaced GI
- Transparent GIF
- Animation GIF
Image Dimensions
Handset screens for i-mode range quite a bit in size, as you can see in Table 1, which shows a sample of screen sizes of popular DoCoMo i-mode handsets at the time this article was written. Screen size determines the size of images that you can use.
Table 1 - Sample i-mode Screen Dimensions and Color Depth *
Handset Model |
Screen WidthXHeight (Pixels) |
Color Depth |
R691i |
96X72 |
Black and white 4 gradation |
F503i |
120X130 |
256 color |
P503i |
120X130 |
256 color |
N503i |
118X128 |
4,096 color |
SO503i |
120X113 |
65,536 color |
Judging by the range of screen sizes and color support, you should develop i-mode graphics with the following specifications:
Images should be created to display correctly in all screen dimensions. Generally, the maximum dimensions for an image are a width of 90 pixels and a height of 100 pixels.
The i-mode browser will scale a larger image to fit the display. However, this may result in a loss of quality because the pixels in the image must be adjusted to fit the screen width.
Images with a color palette greater than the screen's depth will result in a loss of quality for the viewer. You should reduce the color palette to the lowest acceptable for all images.
Image File Size
The file size of your i-mode images is restricted by the cache size of the handset that will view the page. The default size for many is 5KB, however others have the ability to expand that amount to 8KB, 10KB, or even 15KB. However, unless you are creating dynamic applications that check the user agent string for the specific cache size of the handset making a request, you should stick to 5KB as a maximum.
Remember that the 5KB limit is for your entire i-mode pageincluding the document and images together! Therefore, it is essential that you reduce all your i-mode images to the smallest possible size.
Adding Images to i-mode Pages
Once created, you will want to add your images, either graphics or photographs, to i-mode pages. To do this, you will need to know about the image element. This element is the same in both i-mode compatible HTML and XHTML Basic, and is used to indicate to the i-mode microbrowser that an image is to be inserted into the page at the point where the image element exists.
The image element is img, but alone it will not be very useful because it requires an attribute src, which means source, to indicate the location of the image that is to be inserted. The source can be either a relative reference to filename, or an absolute reference to an image elsewhere on the Internet. For instance, a relative reference to an image file on your own system is the following:
<img src="images/logo.gif" />
An absolute image reference would look like this:
<img src="http://www.adcorejapan.co.jp/i/images/logo.gif" />
Attributes for the Image Element
There are a number of attributes that can be used with the image element to change things such as the size, alignment, and space around your images. Table 2 outlines these, along with the type of data allowed as a value.
Table 2 - Image Attributes
Attribute and Value |
Description |
src="x" |
Relative filename or absolute URL of the image file to be displayed |
align="x" |
To align the image within the microbrowser screen. Values choices are top, middle, bottom, left, and right |
width="x" |
The width of the image in number of pixels, or as a percent value relative to the width of the screen |
height="x" |
The height of the image in number of pixels, or as a percent value relative to the height of the screen |
hspace="x" |
Number of pixels of whitespace to the left and right of the image |
vspace="x" |
Number of pixels of whitespace at the top and bottom of the image |
alt="x" |
Character string that serves as the title of the image |
longdesc="x" |
Character string that serves as a description of the image |
border="x" |
Number of pixels to display as a border around the image |
Special i-mode Pictograms
If you have read the other articles in this series, you should know that i-mode HTML is a subset of HTML, which has been adapted with custom tags and additional pictogram icons. These icons comprise about 200 images, and include images of everyday things such as hearts, cars, clouds, and other useful symbols. Because the i-mode pictograms are located in the browser on the handset itself, they do not need to be downloaded from a server to be displayed on an i-mode page. In this way, using them instead of your own icon images is a way to greatly reduce download time and user expense.
In order to include one of these symbols on your page, reference the decimal code in Table 3, and include the code anywhere in your document.
Table 3 - Decimal Code
Decimal Code |
Description |
 |
Sunny |
 |
Cloudy |
 |
Snow |
 |
Baseball |
 |
Golf |
 |
Car |
 |
Airplane |
 |
House |
 |
Post office |
 |
Hospital |
 |
Bank |
 |
Restaurant |
For example, Listing 1 includes four i-mode pictograms for various types of weather, and displays them along with their text descriptions. The microbrowser will replace the decimal code with the icon for the symbol. An example of this can be seen in Figure 1.
Listing 1: i-mode Pictograms for Weather
<html> <head> <title>i-mode Symbols</title> </head> <body> <h1>Pictograms</h1>  Sunny  Cloudy  Rain  Snow </body> </html>
Figure 1 - i-mode symbols can be used to display images of common things such as weather icons.
For specifications about i-mode images, and a complete list of i-mode pictograms, check out the NTT DoCoMo i-mode site ( http://www.nttdocomo.com/i/tagindex.html).