How to convert units?

Hey,

This is the code of CEP:
UnitValue(180, "cm").as("px")
How to do this in uxp?

thanks

Maybe this answer from @simonhenke will help

@Karmalakas Thank you very much.

    let doc = await app.activeDocument;
    let r = doc.resolution;
    let w = doc.width;
    let h = doc.height;

    let cm=1;
    let px=(cm/2.54)*r;

Since Ps v23.4 there’s a method convertUnits() in the app itself

1 Like

Thank you for your help.@Karmalakas