Image map utility

File Name: (24 bit BMP)

Start Flag Color:
R    G    B

Path Color:
R    G    B

Offset:
X    Y

This image mapper will look for a flagged point on an image. Starting at that point, it will follow a path of an indicated color around a polygon marking all of the points needed to define the polygon. This set of points can be used in an image map to define the polygon. The image mapper can follow anti-aliased lines, provided there is sufficient contrast between the line and the background.

Depending in the clarity of the image, this mapper provides a set of points that are accurate and concise.

The information you provide

An image file. The file must be a 24 bit BMP image. Why a 24 bit BMP? Because I know how to extract the pixel data from a 24 bit BMP, and I can't get the graphics modules that support other formats to work on my host.

The image will have a clearly defined path around a polygon made up of pixels of the same or similar colors. The path should form a closed polygon with no breaks. No other lines in the path color may intersect the path. One pixel on the path will be flagged with a unique color to mark a starting point for the path tracer. The path must require at least 6 data points to define the polygon.

An image may require some touch up before the path tracer can follow the path.

The color of the starting point on the polygon. Specify the RGB value in decimal if the starting point. There should only be one pixel with that color on the bitmap. You can leave the RGB value blank and set pixel (0, 0) to the flagged pixel color to indicate the flagged pixel.

The color of the path. Specify the RGB value in decimal of the path. If the path is made up of similar colors-–as in an anti-aliased image--specify a path color that contrasts with the background. You can leave the RGB value blank and set pixel (1, 0) to the path color to indicate the path color.

An optional image offset. In order to speed up the process of finding and following the path, you may cut an image containing the polygon out of a larger image. Specify the X,Y coordinates of the position where the smaller image was cut from the larger image. The points returned will be relative to the larger image.

The points will be returned in two formats.

  1. As a set of points in (x1, y1) (x2, y2) format to facilitate checking the accuracy of the points.
  2. As string of points in x1,y1,x2,y2,x3,y3 format for use in your image map.

If the tracer is unable to follow the path, a set of points will be returned along with an error message.

There will also be a link to a BMP file with the points marked in the starting point color. If your browser is able to display BMPs inline, the BMP will appear on the web page. You can see from the BMP whether the path tracer got lost, and where it got lost, so you can see if you need to touch up the image and try again.

Reasons the tracer may be lost

This is the source image, magnified 4 times. It is an outline of the state of Nebraska.


 

The image has been cleaned up for the image mapper. The intersecting lines are cut off. The pool of grey pixels on the north east corner has been removed. A starting point has been selected. A few pixels have been lightened. The tracer prefers pixels that are close to the selected path color. Areas where pixel color may cause confusion (pixels with nearly identical colors not clearly following the path) have been touched up.

The selected path color is RGB(112, 118, 133). The starting point has been marked in red.


 

The points marked in red on this image are the points found by the image mapper for the image above.


The image above was cut from a map of the United States. If you specify an offset, the image mapper will return points relative to the larger image. The image was cut from the larger image at position (166,87), so (166,87) is the offset.