Insights and discoveries
from deep in the weeds

Monday, April 18, 2011

Resize an image map online

Recently I tried to find an online tool to resize an image map. Not the image itself, that's easy, and there are already lots of such tools. But to regenerate all the coordinate information for the image map.

I couldn't find one. So I wrote one in Javascript. It's now under Image Map Resizer on this blog. This was also sort of an experiment to see if Blogger would let you get away with Javascript & jQuery. It does! Just include jQuery from the CDN in your page template, use no parsing when you edit the HTML, and you're good to go.

If you want to dynamically resize an image in a web application, along with its image map coordinate information, the code could be used with few changes to do that as well. This would have the effect of the client's browser performing the scaling, which is usually not preferable to creating the source in the size you want, but in some situations could be necessary.

The general idea of using jQuery on blogger also opens lots of possiblities... you could do almost anything you wanted by cleverly manipulating the resources on blogger, I would imagine up to and including ajax. For example, Blogger lets you have ten "pages" of static information in addition to blog posts. You could use one of them as a content placeholder, and use jQuery to get specific content out of it using ajax, to get around that limit. Or use it to make substantial changes to the page layout.


  1. I humbly rephrase the grammatical structure of your first paragraph since it took me a while to understand what you were saying:

    Recently, I tried to find an online tool to re-size an image map, not the image itself because that's easy and there are already lots of such tools, to regenerate all the coordinate information for the image map.

    1. I understood it better the way it was, but I feel a few extra words would make the paragraph crystal clear: Below is my attempt to clarify the sentence (as if it really needs clarification-- everyone knows resizing an image doesn't require special software.)

      When the image for which an image map has been generated is either downsized or else displayed with a smaller pixel dimension than it had at the time the image map was created, the links (or "hotspots" are displaced from their appropriate location on the image. Recently, I tried to find a an online tool that would regenerate the coordinates of the links so that they would again correspond to the appropriate location on the resized image and would create a new image-map having the updated coordinates.

      I couldn't find one so ....

  2. Well, I use Ubuntu and have an imagemap file that I wanted to use to test with. The problem I had was that when I put in the path and file name of the .png file on my hard drive it said it could not load it.