Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

how to convert pixels in mm ?

$
0
0

Hello everybody!

I'm making a tool in which the user specifies the size of the frame, I want to give him the opportunity to choose between units of measurement. How do I convert one unit to another? Centimeters to millimeters as I know :-)

The calculations in my instrument produced in pixels. A user wants to place on a sheet of paper photos of a certain size in order to then cut them after printing and pasted into the frame.

 

This part of the script produces the  selection of the pixel size, but calculation was conducted in millimeters.

app.preferences.rulerUnits = Units.MM;


var newSelect = Array(
                   Array(Left, Top),                   Array(Right, Top),                   Array(Right, Bottom),                   Array(Left, Bottom),                   Array(Left, Top)
 );
 doc.selection.select(newSelect);

 

Came up with a solution, I do not know how much it is optimal - use factor

app.preferences.rulerUnits = Units.MM;
rmm = doc.width;
app.preferences.rulerUnits = Units.PIXELS;
rpix = doc.width;
var propPixMm = rpix.value/rmm.value;

Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>