12 Replies Latest reply on Jan 10, 2017 6:56 AM by JJMack

# Is there a way to make Photoshop show out coordinates of certain pixels?

Hey, I need to be able to find the start and end coordinates of a line of pixels. Is there a way to select an entire pixel and find out it's coordinates? I can only seem to find the coordinates of a single point, which selects at the start or end of the pixel, but not the pixel itself. (It gives the correct coordinate, but it'd be easier to set my cursor to lock onto pixels and move in pixels.) Thank you

• ###### 1. Re: Is there a way to make Photoshop spit out coordinates of certain pixels?

You lost me with the first sentence. "If I'm folding an equilateral triangle that's 100px wide, that means I simply fold 100 pages in 2 spots per page."

I know an equilateral triangle has three equal length sides and three equal angles each 120 degrees. I assume you mean the base of the triangle is 100px as the width.  You gave no information about aspect ration of a page or it dimensions.  So I have no ideal if sad page could be folder into a 100Px  equilateral triangle with two folds.  I assume your books have 100 pages.

• ###### 2. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

I was in the process of editing the post for that exact reason, but then realized that even if there was an answer to my question, it wouldn't work for the book folding! I have thought of another option though.

I need to be able to find the start and end coordinates of a line of pixels. Is there a way to select an entire pixel and find out it's coordinates? I can only seem to find the coordinates of a single point, which selects at the start or end of the pixel, but not the pixel itself. (It gives the correct coordinate, but it'd be easier to set my cursor to lock onto pixels and move in pixels.)

If it's possible to move your cursor in pixels instead of smoothly, great. If not, is there a way to measure a selection?

I want to know the start and end coordinates of a group of pixels. If I select a group of 5 pixels vertically, about half way down a 100px x 100px file, is there a way to see: x:0 y:50-55 ? All I can seem to get it to show is where my cursor is currently. Of course I could move the cursor from the top pixel, then the bottom and get both numbers that way, but is there a way to select all 5 pixels and have it show me all that info in one spot?
I've tried Window->Info, and it shows the info i wrote about previously, I've also tried the ruler tool, but that selects between pixels and only says the coordinates of where I started and how many pixels long the ruler is, rather than the coordinates of the end point.

This is just to streamline something, it's not the biggest deal if I have to manually select the start pixel, copy down the coordinates, then the last one and do the same, but it'd sure make the process a lot faster if I could see it all!

Thank you

• ###### 3. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

Hi

Seem the Op changed it's text/explanation. But, I still dont understand the goal. If you draw a 1px line, you can get the X/Y coordinates.

 The OP posted a new "text/explanation".

Pierre

• ###### 4. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

The OP need to use their brain a bit more to focus one what the want to do. It is  a line the its a selection a selection can be any shape and have transparency partial opacity, opacity less than 100%.    OP if you want to use logic in you Process you need to use some Programming language to program a script or plug-in. In any case you need to know how Photoshop Works and what may be possible. Most of all the OP need to know what they actually want to. So they can design a process to accomplish what they want to do.

• ###### 5. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

Hi

Yes. At first I thought the Op was kinda trying to calculate the "bookbinder width for the cover". But' I'm still confuse.

Secondly, I thought the OP was working on "origami folding" !!

I'm still confuse.

Pierre

• ###### 6. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

If you select 5 pixels in a line going down, I'm trying to figure out if there's a way in one single place to view both the x and y coordinates of the first pixel and the last one in the selection. For example, if the 5 vertical pixels selected are in the top left of the canvas, the Window->Info toolbox simply says  X:0, y:4, and it says the selection is 5 pixels long. But I'm trying to figure out if there's a way to see that the selection is X:0, y:0 - X:0, y:4, all in one screenshottable spot, rather than mousing over the first pixel for that coordinate and having to mouse over the 5th pixel for the second one. It seems like a tiny thing but when you need to convert specific measurements to paper hundreds of times, it's a lot more efficient

And the original post was edited because it's difficult to fully explain a craft that I'm certain nobody on these forums does or cares about enough to learn about to simply answer a question Basically, even if I could somehow have photoshop spit out x and y axis's for each page folded, once there's overlappings in letters that require you to stagger page folds, the numbers would be irrelevant. That's why I've settled on my new dilemma.

• ###### 7. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

Hi

I'm certain nobody on these forums does or cares about enough to learn about to simply answer a question

It's not very fair of you to say this.

But, maybe someone else can understand you better.

Pierre

• ###### 8. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

A pixel is essentially the same thing as a single point in Photoshop.  If you zoom in far enough to see the pixel grid, and select a brush with a square brush preset set to 1 pixel, then although you appear to be able to hover between pixels, that is an illusion.

As you move the cursor — with the Info panel close to the cursor — the coordinates will snap to the nearest whole pixel.  If you try to stamp down with your 1 pixel brush, it will always be placed exactly on the nearest whole pixel.  What else can it be?

With lighter tones it can be difficult to see the pixel grid.  You can use the same work around that we use for work paths...  Place a layer filled with black at the top of the stack, and set its opacity to 50% (or there abouts)

Incidentally, there is nothing the regular posters to this forum like more than a question they don't know the answer to, because we can then try _very_ hard to work out the answer.  There's kudos to be the first with the answer (unspoken but I am sure we are quietly pleased).  But most importantly, we get to know a little bit more about the program we love.  You'll not find another group of people who will try harder to answer even the most obscure and difficult questions.

[EDIT]  I meant to say that if you copy your selected line of pixels to a new layer, then guides will snap top the end of that line when dragged out from the rulers.  Make sure your rulers are set to Pixels, and the job becomes super easy.

• ###### 9. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

k.morpls wrote:

I'm trying to figure out if there's a way in one single place to view both the x and y coordinates of the first pixel and the last one in the selection.

It is simple geometry you know that class you took in high school. You had to figure the imformation out using logic. Once you figured out all you want to know. You could write it down in one place and see the information in the form you want to see it in.

It may be a few years since you took that course.  I'm 76 now took that class when I was 14 or 15 I can not remember exactly how old I was some some 60 years ago.  Thing have changed for me in those sixthly  years but geometry has not.  As I wrote before to do see what you want you need to use logic. You need know how Photoshop works and need to program the process and use logic. In the logic you need to use your high school geometry.  It is quite simple when you know how Photoshop works know geometry and can hack at JavaScript.  Rectangle are very easy and all selection have a rectangle selection bounds.  It is easyer to deal with the selection bounds then to deal with a complex shape selection. like a triangle that mat be  rotates  some on a canvas.  You can display with ease information about the selection bounds.  What you want to display and how you want to see it displayed is up to you.  You could even add the information to the document as a text layer.  For example I'll show information about two layers bounds.  Layers like selections have rectangle bounds as does the documents canvas.  The document's canvas coordinates are top left corner 0x,0y bottom right corner widthX heightY.  Layers  bounds need not even be over the documents canvas and may even be larger the the document's canvas so it top and bottom  will has    leftX,topY  rightX,bottomY. where left,top,right,bottom values may be plus or negative

• ###### 10. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

That answer is not correct! It shows one pixel not the first and last pixel coordinates....  a script is required....

Line length can also be calculated  Square root of (width squared + height squared).

Here is a script that will calulate Line length  and show the start and end coordinates.

```// enable double-clicking from Mac Finder or Windows Explorer
// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events
app.bringToFront();

// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits;
// Set Photoshop to use pixels
app.preferences.rulerUnits = Units.PIXELS;

try{
var LB = activeDocument.activeLayer.bounds;
var LWidth = (LB[2].value) - (LB[0].value);
var LHeight = (LB[3].value) - (LB[1].value);
var LLenght = Math.round(Math.sqrt(LWidth*LWidth+LHeight*LHeight));
/*
MarkX((LB[0].value + LWidth/2));
MarkX(LB[0].value);
MarkX(LB[2].value);
MarkY((LB[1].value + LHeight/2));
MarkY(LB[1].value)
MarkY(LB[3].value)
*/
alert("'" + activeDocument.activeLayer.name + "' Layer Bounds\nTop Left " +  LB[0].value + "X," +  LB[1].value + "Y     Bottom Right "
+  LB[2].value + "X," +  LB[3].value + "Y"
+ "\nLine Length " + LLenght + "px   Width " +  LWidth + "px   Height " + LHeight +"px"
/*
+ "\nLayer center relative to canvas " + (LB[0].value + LWidth/2) + "X," +  (LB[1].value + LHeight/2) +"Y"
*/
);
}

// Return the app preferences
app.preferences.rulerUnits = startRulerUnits;
function MarkX(x) {
// =======================================================
var idMk = charIDToTypeID( "Mk  " );
var desc61 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw  " );
var desc62 = new ActionDescriptor();
var idPstn = charIDToTypeID( "Pstn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc62.putUnitDouble( idPstn, idPxl, x);
var idOrnt = charIDToTypeID( "Ornt" );
var idOrnt = charIDToTypeID( "Ornt" );
var idVrtc = charIDToTypeID( "Vrtc" );
desc62.putEnumerated( idOrnt, idOrnt, idVrtc );
var idGd = charIDToTypeID( "Gd  " );
desc61.putObject( idNw, idGd, desc62 );
executeAction( idMk, desc61, DialogModes.NO );
}
function MarkY(y) {
// =======================================================
var idMk = charIDToTypeID( "Mk  " );
var desc63 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw  " );
var desc64 = new ActionDescriptor();
var idPstn = charIDToTypeID( "Pstn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc64.putUnitDouble( idPstn, idPxl, y );
var idOrnt = charIDToTypeID( "Ornt" );
var idOrnt = charIDToTypeID( "Ornt" );
var idHrzn = charIDToTypeID( "Hrzn" );
desc64.putEnumerated( idOrnt, idOrnt, idHrzn );
var idGd = charIDToTypeID( "Gd  " );
desc63.putObject( idNw, idGd, desc64 );
executeAction( idMk, desc63, DialogModes.NO );
}

```
• ###### 11. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

Hi

Cant't the "Ruler Tool" help with this ?

Pierre

• ###### 12. Re: Is there a way to make Photoshop show out coordinates of certain pixels?

Yes and No.  While the ruler will show that information.  It requires the you manually use it.  How well you use it influences the values shown.  Here I zoomed the image to 200% and ran the script to see what values it shows for the line length and coordinates.  I then use the ruler tool and tried to measure the line the numbers were off.  I modified the script to add more information and add guide line I could snap the ruler tool to,  After that then I used the ruler tool this time I was able to then measure the line correctly.

The Ruler does show the information need to know the coordinates of the line ends but does not actually show both it shows the start point . A script can show more information the way you want to see it and mark a layer bounds or a selection bounds better then the ruler tool can measure IMO.

```// enable double-clicking from Mac Finder or Windows Explorer
// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events
app.bringToFront();

// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits;
// Set Photoshop to use pixels
app.preferences.rulerUnits = Units.PIXELS;

try{
var LB = activeDocument.activeLayer.bounds;
var LWidth = (LB[2].value) - (LB[0].value);
var LHeight = (LB[3].value) - (LB[1].value);
var LLenght = Math.round(Math.sqrt(LWidth*LWidth+LHeight*LHeight));
var LAngle = Math.asin(LHeight/LLenght) * 180/Math.PI;

MarkX((LB[0].value + LWidth/2));
MarkX(LB[0].value);
MarkX(LB[2].value);
MarkY((LB[1].value + LHeight/2));
MarkY(LB[1].value)
MarkY(LB[3].value)

alert("'" + activeDocument.activeLayer.name + "' Layer Bounds"
+  "\nTop Left " +  LB[0].value + "X," +  LB[1].value + "Y"
+  "\nTop Right " +  LB[0].value + "X," +  LB[2].value + "Y"
+  "\nBottom Right "  +  LB[2].value + "X," +  LB[3].value + "Y"
+  "\nBottom Left "  +  LB[0].value + "X," +  LB[3].value + "Y"
+ "\nDiagonal Line Length " + LLenght + "px"
+ "\nWidth " +  LWidth + "px   Height " + LHeight +"px"
+ "\nAngle up from Horizontal " + LAngle
+ "\nLayer center relative to canvas " + (LB[0].value + LWidth/2) + "X," +  (LB[1].value + LHeight/2) +"Y"
);
}

// Return the app preferences
app.preferences.rulerUnits = startRulerUnits;
function MarkX(x) {
// =======================================================
var idMk = charIDToTypeID( "Mk  " );
var desc61 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw  " );
var desc62 = new ActionDescriptor();
var idPstn = charIDToTypeID( "Pstn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc62.putUnitDouble( idPstn, idPxl, x);
var idOrnt = charIDToTypeID( "Ornt" );
var idOrnt = charIDToTypeID( "Ornt" );
var idVrtc = charIDToTypeID( "Vrtc" );
desc62.putEnumerated( idOrnt, idOrnt, idVrtc );
var idGd = charIDToTypeID( "Gd  " );
desc61.putObject( idNw, idGd, desc62 );
executeAction( idMk, desc61, DialogModes.NO );
}
function MarkY(y) {
// =======================================================
var idMk = charIDToTypeID( "Mk  " );
var desc63 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw  " );
var desc64 = new ActionDescriptor();
var idPstn = charIDToTypeID( "Pstn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc64.putUnitDouble( idPstn, idPxl, y );
var idOrnt = charIDToTypeID( "Ornt" );
var idOrnt = charIDToTypeID( "Ornt" );
var idHrzn = charIDToTypeID( "Hrzn" );
desc64.putEnumerated( idOrnt, idOrnt, idHrzn );
var idGd = charIDToTypeID( "Gd  " );
desc63.putObject( idNw, idGd, desc64 );
executeAction( idMk, desc63, DialogModes.NO );
}

```