Find out the position in an image

Moderator: Kathy_9

Post Reply
psphufi
Posts: 69
Joined: Wed Nov 02, 2016 7:41 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 128 GB
Hard_Drive_Capacity: 1 TB
Corel programs: PSP X9, PSP 2018
Location: Germany

Find out the position in an image

Post by psphufi »

Hello,

I wish to find out a position within an image. For example there is a tower and will know the coordinates in top% and left%.

Is this possible?

Thank you!
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Find out the position in an image

Post by LeviFiction »

There are several options, the easiest is to position your mouse cursor where you think the top is and then look at the status bar at the bottom of the program. It should show you the location in pixels of the cursor. It'll be in the bottom right-hand corner. Should look something like this

(x:###,y:###) - (R: ###, G: ###, B: ###, O: ###) -- Image: width x height - bit depth

X and Y are the position of your mouse.

You can also use the pick tool to move the "pivot" point and then look at the tool options to see at what location you placed the pivot. So with the pick tool active you make sure you have a layer selected, you should see a pivot point in the middle of the layer. While holding CTRL click in the pivot point and drag it to a new location. now look a the tool options palette under "Pivot" you'll see the current X and Y location.
https://levifiction.wordpress.com/
psphufi
Posts: 69
Joined: Wed Nov 02, 2016 7:41 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 128 GB
Hard_Drive_Capacity: 1 TB
Corel programs: PSP X9, PSP 2018
Location: Germany

Re: Find out the position in an image

Post by psphufi »

Thanks for your answer!

But this is not the way I am searching for: I got a CSS and HTML-Code which places hotspots to show tooltips, and the code needs the position in percent top and percent left as you see here:
<div class="HotSpot bullet" style="top: 63%; left: 65%;">

So I have to to look for another way...

Have a good time!

Norbert
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Find out the position in an image

Post by LeviFiction »

No, you just need to know math.

Seriously, if you know how large your image is, and you know where a location is in pixels. It's simple math to get the percentage. I imagine you want to use percentages because the site is responsive.

So let's assume that you have an image that's 1440x625 pixels in size. You know the point you want is located at x:325, y:250. 325/1440 = .225 or 22.5%. You can found up or down. 250/625 = .4 = 40%. So your location is top:22%; left: 40%;

It would be easy enough to create a small script that will grab a corner of something and then give you the percentages if you want. A script would work like this, you create a rectangle selection starting where the div should start, then run the script. The script will take the top and left coordinates and do the simple math, returning the percentages to the script-output palette. Which would you prefer, manual math, or a script?
https://levifiction.wordpress.com/
psphufi
Posts: 69
Joined: Wed Nov 02, 2016 7:41 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 128 GB
Hard_Drive_Capacity: 1 TB
Corel programs: PSP X9, PSP 2018
Location: Germany

Re: Find out the position in an image

Post by psphufi »

Math is not the thing I loved in my schooltime... :wink:
psphufi
Posts: 69
Joined: Wed Nov 02, 2016 7:41 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 128 GB
Hard_Drive_Capacity: 1 TB
Corel programs: PSP X9, PSP 2018
Location: Germany

Re: Find out the position in an image

Post by psphufi »

I cannot create such a script... :-(
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Find out the position in an image

Post by LeviFiction »

Didn't say you could, while I admit I didn't make it clear I was offering to make such a script. But I wasn't going to unless you asked.

I've attached the script

Video demo: https://drive.google.com/file/d/1jgzy34 ... e7aIb/view
Attachments
position-script.zip
(436 Bytes) Downloaded 158 times
https://levifiction.wordpress.com/
Post Reply