Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

the centimeter values are not the same

Enthusiast ,
Feb 16, 2024 Feb 16, 2024

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.

 

TOPICS
Actions and scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 16, 2024 Feb 16, 2024

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);

 

 

 

Translate
Adobe
LEGEND ,
Feb 16, 2024 Feb 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 16, 2024 Feb 16, 2024

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 16, 2024 Feb 16, 2024

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 16, 2024 Feb 16, 2024

And BTW there is no Image/Square Size menu

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 16, 2024 Feb 16, 2024

My problem is this, I am creating a panel where there is an edittex, I need it to create a frame around the photo and I need it to be in centimeters, therefore a precision measurement, if I insert 5cm it must be 5cm and not 143. I hope I explained it well.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 16, 2024 Feb 16, 2024

I wanted to write canvas size Unfortunately the translator made a mess.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2024 Feb 16, 2024

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 16, 2024 Feb 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 16, 2024 Feb 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2024 Feb 16, 2024

Pixels are the native unit of measure.

 Canvas size and scripts allow for entry in inches, cm, mm etc., however, they are always going to need to be translated into pixels.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 16, 2024 Feb 16, 2024

Stefano ho scoperto che per realizzare 1 cm servono circa 29px a 72dpi in modo da poter creare una formula, ma non ho proprio idea di come crearla. hai qualche idea?

 

la formula è questa

cm x dpi: 2,54

1x72:2,54=28,34

How do I get the calculation done for example if I put 1cm in edittext how to do the formula to do the calculation.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2024 Feb 16, 2024
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 16, 2024 Feb 16, 2024

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2024 Feb 16, 2024

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);

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 16, 2024 Feb 16, 2024

Stefano ormai mi conosci e sai che poi dovrò adattare il codice al mio pannello uxp Non sempre è possibile ma ci provo. Vi ringrazio per tutto l'aiuto che mi state dando, senza di voi non avrei fatto molto.

 

Stefano I found how to have the dpi of the open image.
thanks for everything

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 20, 2024 Feb 20, 2024

Side note: the UXP DOM is entirely pixel-based (except in a handful of cases mostly related to text hyphenation, IIRC. There isn't a `UnitValue` class in UXP, so the sooner you swallow the pixel pill, the better 😉 

Davide Barranca - PS developer and author
www.ps-scripting.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 20, 2024 Feb 20, 2024

Davide thanks for your intervention
however, with a little effort you can achieve what you need, rightly you need a lot of documentation and study,
but I can say that little by little it can be done.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 21, 2024 Feb 21, 2024

Stefano ho creato un piccolo pannello UXP con la creazione di un bordo in centimetri,
se qualcuno ne ha bisogno può scaricarlo da questo link.

https://www.mediafire.com/file/1qo1cczjn75o8vt/CREATE_BORDER_UXP.zip/file 

 

questa è l'interfaccia

Schermata 2024-02-21 alle 19.19.44.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 21, 2024 Feb 21, 2024

Thanks for sharing with everyone!

It reminds me something I've in the CC Marketplace (it was initially developed for internal use first, but then I decided to publish it): https://www.cc-extensions.com/plugins/canvas-master

Davide Barranca - PS developer and author
www.ps-scripting.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 21, 2024 Feb 21, 2024

Davide, mine is nothing compared to yours,
yours is a masterpiece,
but I promise you that I will work hard to get closer to your professionalism
Thank you for all the help you give to the community

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 21, 2024 Feb 21, 2024
LATEST

@Ciccillotto - Thank you for sharing, I appreciate it and will look at the code as I'm inexperienced with UXP.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines