How to convert cm to px in a screen?
Never report px
in a research paper when you want to communicate about a stimulus size on screen, it is not a sign of reproducibility because the pixel size of my screen is not necessarily the same pixel size than yours.
All three of these have 1920x1080 px screens. – gronostaj in this forum
The variables / constants you must have are :
-
distanceFromScreen
usually 50 cm (Yung et al., 2015) -
pxPerDeg
(to compute it, you can use this calculator) expectedStimulusSizeWidth
Here is the JS code to compute the expected size (in cm) of a stimuli :
const stimWidthRad = 2 * Math.atan((expectedStimulusSizeWidth / 2) / distanceFromScreen); // stimulus width in radian
const stimWidthDeg = stimWidthRad * 180 / Math.PI; // stimulus width in degrees
const stimWidthPx = stimWidthDeg * pxPerDeg; // stim width in px from real monitor size in cm.