Skip to content

Instantly share code, notes, and snippets.

@thomasxbanks
Created February 20, 2018 12:36
Show Gist options
  • Select an option

  • Save thomasxbanks/4d77df4013e50f80c7a2da5b8df93e55 to your computer and use it in GitHub Desktop.

Select an option

Save thomasxbanks/4d77df4013e50f80c7a2da5b8df93e55 to your computer and use it in GitHub Desktop.
const calculatePixelsFromPoints = (pt) => {
var dpi = 96
return ((pt / 72) * dpi).toFixed(0)
}
let val = 0.5
console.log(`${val}pt = ${calculatePixelsFromPoints(val)}px`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment