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

the centimeter values are not the same

Engaged ,
Feb 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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

Views

477

Translate

Translate

Report

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

 

 

 

Votes

Translate

Translate
Adobe
LEGEND ,
Feb 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

And BTW there is no Image/Square Size menu

Votes

Translate

Translate

Report

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 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

 

 

Votes

Translate

Translate

Report

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 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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