Ok so I have a picture of a map with little dots for each city on the map, and I want to find the coordinates of each dot. The only way I've been able to think of was using the "info" panel on photoshop and hovering the mouse over each dot then alt+tabbing on a text file and typing up the coordinates then returning to the dots, doing that over and over.

And that's pretty boring and time-consuming, so I was wondering if there was another way. I don't actually care if I have to erase the map and separate the points to do it, I just need the names of the cities and their coordinates in pixels.

Is there a non-boring way of doing this?

enter image description here

  • It would be (Much much) easier if you had a vector version of the map and used illustrator. (you wouldn't need to select and click anything much at all) Now you need to click and type names. – joojaa Dec 19 '15 at 7:17

Do this:

  1. Select the black dots with Select → Color Range.... Pick any point on a dot and use a large fuzziness of say 103. Dont worry that the text gets selected we will deal with that next.

  2. Shrink the selection by 3 pixels, choose Select → Modify → Contract..., contract by 3 points (in this image).

  3. With the select tool active right click on canvas and chose Make Work Path, use a setting of 0.5

  4. Run following script, choose a file name to put data into:

        #target photoshop
        function main() {
            var layers = app.activeDocument.pathItems[0];
            var file = File.saveDialog('save marker info', 'markerinfo:*.txt');
            handleSubpaths(layers, file);
        function handleSubpaths(path, file){
            var numLayers = path.subPathItems.length;
            file.write("name, position x, position y\n"  );
            for (var j = 0; j < numLayers; j++) {
               var subpath = path.subPathItems[j];
               var pos = average(subpath.pathPoints);
                          "marker_"+ (j+1) +", " + 
                          pos[0] + ", "+
                          pos[1] + "\n"
        function average(points){
            ret = [0,0]
            for (var i = 0; i < points.length; i++){
               var p = points[i].anchor;
               ret[0] += p[0]/points.length;
               ret[1] += p[1]/points.length;
            return ret;
  5. Read the data from the text file, or use a spreadsheet. Excerpt form result:

    name, position x, position y
    marker_1, 388.75, 137.5
    marker_2, 509.5, 180.25
    marker_3, 792.25, 179.5
    marker_4, 403.75, 183.5

Done. Anyway, if you can find a vector version of the image and use illustrator one could automatically scrape the names also.

  • this is a nice solution except that we don't knows where is "marker_n" on the photoshop file? ... is it possible to use Count Tool which I can mark all points with the sequence I want. and then extract the content to a txt file? – hsawires Dec 19 '15 at 20:35
  • @hsawires i was trying to do this with count first but this was faster to repurpose. For me it was supprising that the measirement log does not take position up for selections and counts seems like a oversight. Anyway i can turn them to text layers, positioned on the point, so all you need is to type in the names. – joojaa Dec 19 '15 at 21:23
  • @hsawires also like i said had this been vectors and illustrator i could have scraped the names in same go. – joojaa Dec 19 '15 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.