# Screen resolution and image size

**URL:** <https://psychtoolbox.discourse.group/t/screen-resolution-and-image-size/1862>\
**Category:** Uncategorized\
**Created:** [August 31, 2007, 3:47pm UTC](https://psychtoolbox.discourse.group/t/screen-resolution-and-image-size/1862 "2007-08-31T15:47:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![remya\_712](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@remya\_712](https://psychtoolbox.discourse.group/u/remya_712)\
**Post date:** [August 31, 2007, 3:47pm UTC](https://psychtoolbox.discourse.group/t/screen-resolution-and-image-size/1862/1 "2007-08-31T15:47:44Z")

</div>

Dear All,  
  
I have a question regarding the changing size of my stimuli with  
change in the screen resolution.My program displays various shapes on  
the screen. Currently the size of the shapes is tied to the resolution  
of the screen.. what I mean is that , when I switch to a lower  
resolution, the shapes become too big to fit on the screen.  
Naturally, I want the size of the shapes to change proportionally when  
I change the screen resolution. Is there any way of doing this...any  
suggestions/ideas?   
  
Thanks in advance!  
  
RN

---

<div class="post-metadata">

**Author:** ![pmineault2](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@pmineault2](https://psychtoolbox.discourse.group/u/pmineault2)\
**Post date:** [September 2, 2007, 1:43am UTC](https://psychtoolbox.discourse.group/t/screen-resolution-and-image-size/1862/2 "2007-09-02T01:43:54Z")

</div>

I generally keep track of distance to the screen, monitor width and  
height, and screen resolution. From then it's trivial to calculate the  
angular size of a pixel using the small angle approximation, sin(x) ~  
tan(x) ~ x, and tan(angular width of a pixel in radians) ~ angular  
width of a pixel in radians = monitor width/(screen resolution \*  
viewing distance), same goes for angular height. Then keep all sizes  
as angle measurements and convert on the go, num horizontal pixels =  
desired angular width in radians / angular width of a pixel in  
radians. One thing that simplifies coding is to have all measurements  
from the center of the screen, for example Screen('DrawDots') can take  
an optional argument that specifies the center of the coordinate  
system, set it to [resolutionX/2 resolutionY/2]. And of course you can  
get the current resolution of the screen from [win rect] =  
Screen('OpenWindow'), with resolutionX = rect(3) and resolutionY =  
rect(4).  
  
Patrick  
  

> On 8/31/07, Remya \<[remya\_nair@...](mailto:remya_nair@...)\> wrote:  
> \> Dear All,  
> \>  
> \> I have a question regarding the changing size of my stimuli with  
> \> change in the screen resolution.My program displays various shapes on  
> \> the screen. Currently the size of the shapes is tied to the resolution  
> \> of the screen.. what I mean is that , when I switch to a lower  
> \> resolution, the shapes become too big to fit on the screen.  
> \> Naturally, I want the size of the shapes to change proportionally when  
> \> I change the screen resolution. Is there any way of doing this...any  
> \> suggestions/ideas?  
> \>  
> \> Thanks in advance!  
> \>  
> \> RN  
> \>  
> \>  
> \>  
> \>  
> \>  
> \> Post your message to: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)  
> \> Please indicate OS9, OSX, or WIN version, and include your full name.  
> \> Denis Pelli, David Brainard, and Allen Ingling.  
> \> [http://psychtoolbox.org](http://psychtoolbox.org)  
> \>  
> \> Yahoo! Groups Links  
> \>  
> \>  
> \>  
> \>
