Skip to main content
Inspiring
February 16, 2024
Answered

the centimeter values are not the same

  • February 16, 2024
  • 2 replies
  • 1815 views

when I go to the image/square size menu
I select centimeters and enter a value of 10cm
when I convert the action instead of 10cm I find the value of 283.000000, I can't understand where I'm wrong
someone help me for this.

 

This topic has been closed for replies.
Correct answer Stephen Marsh

I thought it was simpler Now I'll see if I can find something more intuitive.


Your recent topics have been about UXP.

 

Now it seems that you are using legacy ExtendScript?

 

It all depends on the current resolution, I'm not sure if this helps or not?

 

var theRes = app.activeDocument.resolution; // PPI
var theUnitAsCM = (theRes/2.54); // 1 CM
alert("The resolution in PPI divided by 2.54:\r" + theUnitAsCM + "\r\rHowever, we can't have a floating value!");
oneCMasPX = parseInt(theUnitAsCM); // 1 CM to PX integer
alert("1 CM in PX at the current Res:\r" + oneCMasPX);

 

 

 

2 replies

Stephen Marsh
Community Expert
Community Expert
February 16, 2024

You can set ruler units in your code, however, Photoshop is always using pixels as the native unit.

Inspiring
February 16, 2024

Stefano I have tried all the methods but none of them work for me, What's the point of putting centimeters if you can't use it?

Legend
February 16, 2024

You may not get exact centimeters. Photoshop uses pixels, if the resolution doesn't match you might get 4.99 cm instead.

And use an editnumber instead of edittext for your size.

Legend
February 16, 2024

That value is probably pixels, not cm. Photoshop is a pixel-based editor, inches and cm are derived values.

At 72 pixels per inch, 10cm would be 283.4 pixels.

Inspiring
February 16, 2024

Thanks for the explanation
do you know how I could solve this problem

 

Legend
February 16, 2024

I don't understand what the problem is. Please explain.