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.
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);
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.
Copy link to clipboard
Copied
Thanks for the explanation
do you know how I could solve this problem
Copy link to clipboard
Copied
I don't understand what the problem is. Please explain.
Copy link to clipboard
Copied
And BTW there is no Image/Square Size menu
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.
Copy link to clipboard
Copied
I wanted to write canvas size Unfortunately the translator made a mess.
Copy link to clipboard
Copied
You can set ruler units in your code, however, Photoshop is always using pixels as the native unit.
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?
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.
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.
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.
Copy link to clipboard
Copied
An example in this topic of ruler units in CM:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/resize-a-layer/td-p/10498297
Copy link to clipboard
Copied
I thought it was simpler Now I'll see if I can find something more intuitive.
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);
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
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 😉
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.
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
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
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
Copy link to clipboard
Copied
@Ciccillotto - Thank you for sharing, I appreciate it and will look at the code as I'm inexperienced with UXP.