Created
September 14, 2016 09:25
-
-
Save kezabelle/a3f4b81f542a597141ddb89dadeb6b6f to your computer and use it in GitHub Desktop.
I need to know the maths for pixels + DPI to mm. For kitely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
python mm2px.py 290 210 150 | |
""" | |
import sys | |
w = float(sys.argv[1]) # 1830 | |
h = float(sys.argv[2]) # 1547 | |
dpi = int(sys.argv[3]) # 150 | |
w_mm = (w * dpi) / 25.4 | |
h_mm = (h * dpi) / 25.4 | |
print((w_mm, h_mm)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
python px2mm.py 1753 1240 150 | |
""" | |
import sys | |
w = float(sys.argv[1]) # 1830 | |
h = float(sys.argv[2]) # 1547 | |
dpi = int(sys.argv[3]) # 150 | |
w_mm = (w * 25.4) / dpi | |
h_mm = (h * 25.4) / dpi | |
print((w_mm, h_mm)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment