# Converting pixels to height unit

**URL:** <https://discourse.psychopy.org/t/converting-pixels-to-height-unit/24344>\
**Category:** Online experiments\
**Created:** [August 2, 2021, 12:01pm UTC](https://discourse.psychopy.org/t/converting-pixels-to-height-unit/24344 "2021-08-02T12:01:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yiannis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yiannis/32/35056_2.png) [@Yiannis](https://discourse.psychopy.org/u/Yiannis)\
**Post date:** [August 2, 2021, 12:01pm UTC](https://discourse.psychopy.org/t/converting-pixels-to-height-unit/24344/1 "2021-08-02T12:01:00Z")

</div>

Hi,

Perhaps a silly question but I am trying to get my head around this.  
I will be presenting images and using “norm” units seems to result in some distortion of the images.

I now want to give it a try with “height” units but I am not sure how to convert pixels to height units.  
If of any help, my screen resolution is 1366 x 768 (which I believe it makes it a 16:9 aspect ratio) and each image is 286 x 397.

I had a look at [Units for the window and stimuli — PsychoPy v2021.2](https://www.psychopy.org/general/units.html) but didn’t help.

Thanks in advance.  
Yiannis

---

<div class="post-metadata">

**Author:** ![Becca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/becca/32/34260_2.png) [@Becca](https://discourse.psychopy.org/u/Becca)\
**Post date:** [August 2, 2021, 1:05pm UTC](https://discourse.psychopy.org/t/converting-pixels-to-height-unit/24344/2 "2021-08-02T13:05:21Z")

</div>

Hi There!

Pixels can be considered a proportion of height. So 1 unit of height should equate to `win.size[1]` in pixels 0.5 height should correspond to `win.size[1]/2` and so on. In the newest release (2021.2) you can try the inbuilt demo which gives a nice visualisation of different units. This can be accessed from builder using Demos \> Understanding PsychoPy \> spatial Units. You shouldn’t need to apply any conversion using code and PsychoPy should apply this anyway when units are height.

Hope this helps!  
Becca

---

<div class="post-metadata">

**Author:** ![Yiannis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yiannis/32/35056_2.png) [@Yiannis](https://discourse.psychopy.org/u/Yiannis)\
**Post date:** [August 2, 2021, 2:08pm UTC](https://discourse.psychopy.org/t/converting-pixels-to-height-unit/24344/3 "2021-08-02T14:08:17Z")

</div>

Thanks @Becca for your prompt reply. I think I get it.  
Unfortunately I cannot upgrade psychopy just yet as my exp does not run with this newest version - too much code to find out why it does not, it’s an online staircase exp.

---

<div class="post-metadata">

**Author:** ![Becca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/becca/32/34260_2.png) [@Becca](https://discourse.psychopy.org/u/Becca)\
**Post date:** [August 2, 2021, 2:10pm UTC](https://discourse.psychopy.org/t/converting-pixels-to-height-unit/24344/4 "2021-08-02T14:10:20Z")

</div>

Aha no prob you can also access that demo by downloading the “examples.zip” from the navbar here [https://workshops.psychopy.org/](https://workshops.psychopy.org/)

Becca
