In my experience, the only sure-fire way to get stuff like this to work is using JQuery (don't be afraid, it's just an external script file you have to include). Then you can use a statement like

$('#element').position()

or

$('#element').offset()

to get the current coordinates, which works excellently across any and all browsers I've encountered so far.

Answer from Udo on Stack Overflow
🌐
Html-tuts
html-tuts.com › how-to-find-coordinates-of-an-image-answer
The 2 Best Ways to Find Coordinates of an Image in HTML
January 12, 2023 - Once your hotspots are marked, click on the button that has “Show me the code”. This is where you will find the image coordinates in the HTML code generated. A modal pops up with the “Generated Image Map Output”. The coords are the image ...
🌐
Programming Head
programminghead.com › Projects › find-coordinates-of-image-online.html
Find Coordinates of Image Online - [x,y,rectangle,circle]
To find the X and Y Coordinates of an image online, you can use our Page "link" and by using this page you will be able to get the Coordinates of a Square, Triangle, and Plygans (This will cover 90% of Shapes) In HTML we use area tags for that but before using Area Tags, you will need to Exact Coordinate of a Shape that you want to Map and after that, you will be able to Map an Image using HTML Area Tags.
Discussions

php - Get coordinates of a particular section of the image - Stack Overflow
I want to add a text and link to both the sign boards here in this image (separately for both). I am trying to use the rule and I need to place the coordinates of the two More on stackoverflow.com
🌐 stackoverflow.com
Trying to gather coordinates of images on html webpages
Try to use "Selenium" (pip) find your Element (Picture) and get the location of the Image. But the location is only for the Browser, not for your screen, if you know what i mean. But if you want to save the images you can take a screenshot with selenium and crop the Image with PIL (Pip) or Opencv (also on Pip) and Save it to Hard Drive. Google for Selenium, and getting location for Element in Selenium. More on reddit.com
🌐 r/learnpython
4
1
April 18, 2019
How to find coordinates - HTML-CSS - The freeCodeCamp Forum
when using an image map, how do you calculate coordinates? I already have the elements in place!! map with the name attribute clickable area element but zero ideas how to get specific data from an image More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
June 3, 2023
node.js - Finding the coordinates of an image in every HTML file in a directory? - Stack Overflow
I have a library of flat HTML files with similar image tags. How should I go through all of them and find the specific x, y coordinates on the page of a specific image tag? I'm thinking that I'll ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Quora
quora.com › For-an-image-map-in-HTML-how-do-you-find-the-coordinates-of-the-area-you-want-to-make-clickable
For an image map in HTML, how do you find the coordinates of the area you want to make clickable? - Quora
Answer (1 of 2): I haven’t made an image map in years, but back when I did I usually used Photoshop to find the coordinates. Once you have sized your image to the size you plan to use, you can find the coordinates, using the info window in Photoshop. As an example, imagine I want to use the pin...
Top answer
1 of 5
1

I'm working on something similar, but I wanted to make it responsive - not if you zoom in, image will be bigger and areas too. I didn't use <map>, because the coords are absolute. I used this:

<div id="mapdiv">
  <img src="link" id="imgmap" alt="" />
    <a href="target"><div id="box1">Here is the text</div></a>
    <div id="box2" onclick="alert('You can use js too')"></div>
</div>

And CSS:

#imgmap {
    width: 100%;
    }
div#mapdiv {
    position: relative; /* thanks to this... */
    }
div#menu div {
    position: absolute; /* ...and this are boxes positioned relatively inside the imgdiv */
    border: 1px dashed blue; /* for finding coords, remove after you are done */
}
div#box1 {
    left: 21%; /* my coords, make your own by trying and trying... */
    top: 26.5%;
    height: 5%;
    width: 6.5%
    }
div#box2 {
    left: 7.5%;
    top: 66.2%;
    height: 24.5%;
    width: 31.5%;
    }
2 of 5
1

if you want to add text, then you better use real links and set them on top of your areas wich are quiet good rectangle.

example:

.map {
  position: relative;
}

.map img {
  display: block;
  width: 100%;
}

.map a {
  position: absolute;
  top: 48.6%;
  left: 9.118%;
  width: 19.8%;
  height: 19%;
  transform: rotate(-1.375deg);
  border-radius: 50% 50% 0px 0 / 0.25vw;
  transition: 0.5s;
  color:#3F4754;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:4vw;
  font-weight:bold;
  font-family:courier;
  font-variant:small-caps;
  text-decoration:none;
  text-shadow:-2px -2px 2px black
}

.map a + a {
  top: 48%;
  left: 70%;
  transform: rotate(3deg);
  transform-origin: bottom right
}

a:hover {
  color: white;
  background:linear-gradient(to bottom left, rgba(0, 0, 0, 0.5), transparent);
  text-shadow:2px 2px 2px black
}
<div class="map">
  <img src="https://i.sstatic.net/mDEuy.jpg" />
  <a href="#1">hover me</a>
  <a href="#2">or me</a>
</div>

use your own style and ids or class

🌐
YouTube
youtube.com › majec thoughts
How to get the coordinates of an image// HTML Map Image - YouTube
#HTML#ImageMap#CoordinatesOfImageThis is my first time to do a tutorial about HTML. I hope you like it. Please like, comments and subscribe to improve my tut...
Published   February 10, 2020
Views   29K
🌐
Coderanch
coderanch.com › t › 117394 › languages › coordinates-image
coordinates of an image (HTML Pages with CSS and JavaScript forum at Coderanch)
Hi there, in my html page I have some code like this: Using javascript, is it possible to determine the top left coordinates of this image??
Find elsewhere
🌐
W3Schools
w3schools.com › html › html_images_imagemap.asp
HTML Image Maps
The <map> element is used to create an image map, and is linked to the image by using the required name attribute: ... The name attribute must have the same value as the <img>'s usemap attribute . Then, add the clickable areas. A clickable area is defined using an <area> element. You must define the shape of the clickable area, and you can choose one of these values: ... You must also define some coordinates to be able to place the clickable area onto the image.
🌐
Fiore Communications
fiorecommunications.com › home › how to manually code html image maps
How to Manually Code HTML Image Maps for Your Website
March 18, 2020 - Tweak the position of your cursor until it has the same y value as your center point. Subtract the smaller x value from the larger, and you have your radius. Note: If you are using Photoshop Elements, under the Window menu item, make sure the Info window is selected. This will list the x,y coordinates. For each area or shape you are linking, you will need to include the URL you are linking to. The first html image map you code will take you a while, but like most things, the process gets easier every time you complete it.
🌐
YouTube
youtube.com › watch
HTML Image Mapping / Image Maps [ Coordinates, Area ] - YouTube
HTML Image Mapping / Image Maps [ Coordinates, Area ]Hi thereIn this video tutorial, we are going to cover HTML IMAGE MAPsSo wheneverwe use Images in HTMLmos...
Published   February 27, 2022
🌐
Netcreator
netcreator.co.in › home › how to get coordinates of an image in html
How to get coordinates of an image in HTML - Netcreator -
February 11, 2022 - To get the coordinates of a click within an image in HTML using JavaScript, you can use the click event and retrieve the coordinates using event.clientX, event.clientY, event.offsetX, and event.offsetY. Here’s an example: Example Code: Explanation: event.offsetX and event.offsetY give the ...
🌐
Chestysoft
chestysoft.com › imagefile › javascript › get-coordinates.asp
Javascript example to find the mouse coordinates on an image in the browser.
The GetCoordinates function uses the window.event method to find the coordinates of the mouse when it is clicked. It also needs to take into account any scrolling and the position of the image inside the document so that the coordinates are always relative to the top left of the image.
🌐
W3Schools
w3schools.com › Tags › att_area_coords.asp
HTML area coords Attribute
The coords attribute specifies the coordinates of an area in an image map. The coords attribute is used together with the shape attribute to specify the size, shape, and placement of an area.
🌐
Mga
itwebtutorials.mga.edu › html › chp7 › image-maps.aspx
Image Maps : MGA - Web Development Tutorials
Usually, graphic programs display the horizontal and vertical coordinates of the mouse pointer as you move it around the image. By viewing this display, you can determine the exact pixel coordinates that define the shapes of those clickable areas. Once this information is determined, you can code the HTML to convert the picture to an image map.
🌐
EncodedNA
encodedna.com › 2014 › 08 › get-find-x-y-coordinates-of-an-image-on-mouse-click-mouse-over-using-jquery.htm
Get X, Y Coordinates of an Image on Mouse Click or Mouse Move using jQuery
We can find the X and Y coordinates using jQuery pageX and pageY events to locate the mouse position on the image or any element to be precise.
🌐
Imageonline
imageonline.io › home › find image coordinates
Find Image Coordinates - Get Pixel Position and Color Online
Find coordinates and color values of any pixel in your images. Click or hover to get X,Y position, RGB, HEX, and HSL color values instantly.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › area
<area> HTML image map area element - MDN Web Docs
The text should be phrased so that it presents the user with the same kind of choice as the image would offer when displayed without the alternative text. This attribute is required only if the href attribute is used. ... The coords attribute details the coordinates of the shape attribute in ...
🌐
Reddit
reddit.com › r/learnpython › trying to gather coordinates of images on html webpages
r/learnpython on Reddit: Trying to gather coordinates of images on html webpages
April 18, 2019 -

Hi all, I'm new to python and as stated in the title - I'm looking to learn how to find the coordinates of an image on a webpage. the image is actually a puzzle but the location is in the center. What I've been doing is pixel coordinates however, this isn't great however, because I want to use it on different computers and the pixel coordinates won't due for the different screen resolutions

🌐
freeCodeCamp
forum.freecodecamp.org › programming › html-css
How to find coordinates - HTML-CSS - The freeCodeCamp Forum
June 3, 2023 - when using an image map, how do you calculate coordinates? I already have the elements in place!! map with the name attribute clickable area element but zero ideas how to get specific data from an image