# Creating JPEG files From Screen&#39;s Aperture?

**URL:** <https://psychtoolbox.discourse.group/t/creating-jpeg-files-from-screen-39-s-aperture/1387>\
**Category:** Uncategorized\
**Created:** [June 18, 2002, 4:33pm UTC](https://psychtoolbox.discourse.group/t/creating-jpeg-files-from-screen-39-s-aperture/1387 "2002-06-18T16:33:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 18, 2002, 4:33pm UTC](https://psychtoolbox.discourse.group/t/creating-jpeg-files-from-screen-39-s-aperture/1387/1 "2002-06-18T16:33:29Z")

</div>

Dear Denis,  
  
Within the psych toolbox (for Mac), I'm presently using the  
screen('CopyWindow'...) command to copy an off-screen window to a small  
circular aperture, which is set by the screen(SetDrawingRegion) command.  
  
I'd like to use the IMWRITE command to capture, as a jpeg file, the image  
that's being copied from the off-screen window to the circular aperture.  
  
I've been able to use the IMWRITE command to capture the entire on-screen  
window, but I've not been able to capture just the aperture image.  
  
Any suggestions on how I might isolate and capture the image shown in the  
aperture?  
  
Many thanks!  
  
Nestor  
  
  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Nestor Matthews, Ph.D.  
Assistant Professor  
Department of Psychology  
Denison University  
100 South Road  
Knapp Hall, Room 505A  
Granville, OH 43023 USA  
Phone: (740) 587-5782  
Fax: (740) 587-5675  
E-mail: [matthewsn@...](mailto:matthewsn@...)  
[http://www.denison.edu/~matthewsn/index.html](http://www.denison.edu/~matthewsn/index.html)  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

---

<div class="post-metadata">

**Author:** ![denispelli](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@denispelli](https://psychtoolbox.discourse.group/u/denispelli)\
**Post date:** [June 19, 2002, 5:48pm UTC](https://psychtoolbox.discourse.group/t/creating-jpeg-files-from-screen-39-s-aperture/1387/2 "2002-06-19T17:48:48Z")

</div>

> \>Dear Denis,  
> \>  
> \>Within the psych toolbox (for Mac), I'm presently using the  
> \>screen('CopyWindow'...) command to copy an off-screen window to a small  
> \>circular aperture, which is set by the screen(SetDrawingRegion) command.  
> \>  
> \>I'd like to use the IMWRITE command to capture, as a jpeg file, the image  
> \>that's being copied from the off-screen window to the circular aperture.  
> \>  
> \>I've been able to use the IMWRITE command to capture the entire on-screen  
> \>window, but I've not been able to capture just the aperture image.  
> \>  
> \>Any suggestions on how I might isolate and capture the image shown in the  
> \>aperture?  
> \>  
> \>Many thanks!  
> \>  
> \>Nestor  
> \>  
> \>  
> \>\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> \>Nestor Matthews, Ph.D.  
> \>Assistant Professor  
> \>Department of Psychology  
> \>Denison University  
> \>100 South Road  
> \>Knapp Hall, Room 505A  
> \>Granville, OH 43023 USA  
> \>Phone: (740) 587-5782  
> \>Fax: (740) 587-5675  
> \>E-mail: [matthewsn@...](mailto:matthewsn@...)  
> \>[http://www.denison.edu/~matthewsn/index.html](http://www.denison.edu/~matthewsn/index.html)  
> \>\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

dear nestor  
  
i'm confused by your message since you claim to use IMWRITE to   
capture a window (or offscreen window), yet IMWRITE will only accept   
a MATLAB matrix, not a window.  
  
i am quite sure you are in fact using SCREEN GetImage to copy from   
your window into a MATLAB matrix, and you're giving that to IMWRITE.   
That's the way to do it.  
  
although i implemented the support for SetDrawingRegion, i haven't in   
fact used it in my own work. it is possible that you might be able to   
somehow clip the SCREEN GetImage. However, it should also be easy to   
clip the MATLAB image afterwards.  
  
hope that helps. you seem to already be doing the right things.  
  
best  
  
denis
