# Convert arbitrary coordinates to texture pixel coordinates

I have data which describes word positions on a page in pt coordinates where 1 pt is 1/72 inch. I need to be able to transform these coordinates into pixel space relative to a texture pixel resolution of 1024 by 1587.

I know that I need to somehow normalise the pt coordinates and then use the resultant ratio to multiply by the texture width / height, but I’m not sure of the calculation to perform the normalisation. I’d be grateful for any suggestions.

you need inches-to-pixels scale also known as DPI. without that your task has no solution.

The resolution of your texture is irrelevant when you have a certain DPI. You have a dpi (dots per inch) of 72, so just multiply your inch-value by 72, drop the fractional part and you have pixel coordinates:

``````var DPI = 72.0f;
var coords = new Vector2(2.12f, 3.15f);
coords *= DPI;
coords.x = Mathf.Floor(coords.x);
coords.y = Mathf.Floor(coords.y);
Debug.Log(coords);
``````

This will print 152 / 226 which is the pixel coordinate of the given inch-coordinate (2.12 / 3.15)