Click on the image to place the text.
myImg.src = "mousetext.asp?x=" + PosX + "&y=" + PosY + "&imagetext=" +
The input box is in a form called form1 and is named imagetext. The image tag has an id of myImgId.
<img id="myImgId" alt="" src="red.gif" width="400" height="300" />
This script uses the csImageFile component to create an image. It reads the query string to get the coordinates and text and uses the csImageFile Text method to draw the text at those coordinates. The image is streamed to the browser as a GIF.
Set Image = Server.CreateObject("csImageFile.Manage")
Image.NewImage 400, 300, "FF0000"
Image.TextOpaque = false
Image.TextSize = 18
X = CInt(Request.Querystring("x"))
Y = CInt(Request.Querystring("y"))
Text = Image.DecodeUTF8(Request.Querystring("ImageText"))
If X <> 0 Then
Image.Text X, Y, Text
Response.ContentType = "image/gif"
This technique can be adapted to save the image, or position other features. We have a downloadable example that selects two pairs of coordinates and draws a rectangle on the image.
© Chestysoft, 2013.