Image Map Tutorial
Image Map Tutorial
Table of contents
Create an image-map with Gimp (for JMatchMap).............................................2
Open the image to map with Gimp......................................................................2
Open The Image Map Editor In Gimp..................................................................2
Start Mapping..................................................................................................3
Edit the image-map data...................................................................................4
Edit map info...................................................................................................5
Get the code...................................................................................................6
Clear the code.................................................................................................6
Links..............................................................................................................7
Create an image map online (for JMatchMap)....................................................8
I Mobilefish.com...............................................................................................8
II image-map.net...........................................................................................10
Create an image-map with Gimp (for JMatchMap)
You can download Gimp here. After installation, load Gimp.
The example refers to the "continents.png" image in the "demos_JMM" folder.
Open the image to map with Gimp
In our example, the image to map is continents.png.
Open The Image Map Editor In Gimp
Use Filters → Web → Imagemap.
You will then be able to draw areas on the image with a choosen shape and Gimp
will calculate and save the coordinates (in relation to the image boundaries) of these
areas.
Start Mapping
Choose a shape
On the left select the rectangular or circular shape.
Don't use the polygon shape as JMatchMap will not be able to use it.
Note that using circular shapes is an easy way to point the exact center of
the area which is the only useful data for JMatchMap.
Draw a shape
This is quite intuitive: click on the image, move the pointer, and click again.
Don't worry about the dimensions of the area as JMatchMap will only take care of the
center of the area. Just avoid to create overlapping areas.
As you finish each area, a pop up appears for you to fill in.
Type "#" in the text box for "URL to activate" and type a description of the area in
the text box for "ALT text": it will be very useful when you build your JMatchMap
exercise.
Create the other areas in the same way.
Edit the image-map data
On the right of the working area is a property list of the created areas. A click on one
item of the list automatically selects the corresponding shape in the working area.
You can adjust the position of an area using (above the shapes on the left) or
open the settings window using and change the values of "Upper left x" and
"Upper left y".
Edit map info
Gimp (since version >2.8) transforms the name of your image ("continents.png") in
"[continents] (imported)".
To get the correct name in the code you must change this.
This is the text that is needed when building your JMatchMap exercise.
Save the file (File → Save or ) which will have a map extension (by default it will
be "[continents] (imported).map" that you can change in "continents.png.map").
Note that if you want to modify the created image map later, you will have to open
the image (continents.png), open the image map editor (Filters → Web → Imagemap)
and load the previously saved "continents.png.map" (File → Open, in the image map
editor).
<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:AS -->
<area shape="rect" coords="458,188,487,211" alt="Océanie" href="#" />
<area shape="rect" coords="242,103,288,130" alt="Afrique" href="#" />
<area shape="rect" coords="279,42,298,57" alt="Europe" href="#" />
<area shape="rect" coords="55,42,87,70" alt="Amérique" href="#" />
<area shape="rect" coords="364,42,413,69" alt="Asie" href="#" />
</map>
the cleared text will be :
<img src="continents" width="536" height="258" usemap="#map" />
<map name="map">
<area shape="rect" coords="458,188,487,211" alt="Océanie" href="#" />
<area shape="rect" coords="242,103,288,130" alt="Afrique" href="#" />
<area shape="rect" coords="279,42,298,57" alt="Europe" href="#" />
<area shape="rect" coords="55,42,87,70" alt="Amérique" href="#" />
<area shape="rect" coords="364,42,413,69" alt="Asie" href="#" />
</map>
As it is it will work but not satisfy the validator because you have to use an alt
attribute for an image tag in HTML5.
So modify the code as below:
<img src="continents.png" alt="continents" width="536" height="258"
usemap="#map" />
<map name="map">
<area shape="rect" coords="463,191,475,203" alt="Océanie" href="#" />
<area shape="rect" coords="276,141,288,153" alt="Afrique" href="#" />
<area shape="rect" coords="268,53,280,65" alt="Europe" href="#" />
<area shape="rect" coords="60,66,72,78" alt="Amerique" href="#" />
<area shape="rect" coords="390,53,402,65" alt="Asie" href="#" />
</map>
Links
Download Gimp
Gimp documentation
Gimp (current version) documentation for image map
Create an image map online (for JMatchMap)
There is a lot of web sites where you can create an image map.
Choose one which offers to add a title or alt for the areas. This will help you to create
the exercise.
Most of the time you will have to modify the code that you get from these sites.
I Mobilefish.com
Here is an example obtained on mobilefish.com :
Parts to modify:
change it with the name of your image in your exercise folder (continents.png).
you can leave it as it is or use any name you want (e.g. "map", "areas")
<map name="image-map">
<area target="_self" alt="America" title="America" href="#" coords="73,62,19" shape="circle">
<area target="_self" alt="Africa" title="Africa" href="#" coords="285,144,15" shape="circle">
<area target="_self" alt="Europe" title="Europe" href="#" coords="273,52,17" shape="circle">
<area target="_self" alt="Asia" title="Asia" href="#" coords="392,61,30" shape="circle">
</map>
<map name="image-map">
<area target="_self" alt="America" title="America" href="#" coords="73,62,19"
shape="circle">
<area target="_self" alt="Africa" title="Africa" href="#" coords="285,144,15"
shape="circle">
<area target="_self" alt="Europe" title="Europe" href="#" coords="273,52,17" shape="circle">
<area target="_self" alt="Asia" title="Asia" href="#" coords="392,61,30" shape="circle">
</map>
Note: to know the width and height of an image usually you just have to give the image
file a right click, in the File Explorer, and look at the properties.