IMWrite fuction is not what it seems...

Hi all,

I have problems translating a vector into an image.
The image is a 256 grayscale - a simple Gabor patch
from the GratingDemo.m file. When I try to transform
it to image by adding:

IMWRITE(m,'Gabor.jpg','jpg');

- m is the gabor from the demo.

I see the correct Gabor patch on the screen but when
opening the .jpg file created I get attached image.

I work with 1024*768 * 120Hz * Millions of colors
MacOS9.2.2 on a new G4 machine.
Matlab 5.2.1
Latest psychtoolbox

Thanks in advance,

Rani Bar-On
IIPDM
Psychology Department
University of Haifa

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
dear rani
your image is inappropriately scaled and cast. 'm' is an array
of doubles in the range -1 to +1. to write with 'imwrite' make it
a 'uint' (unsigned integer) in the range 0 to 255, thus:
imwrite(uint8(128+127.*m),'Gabor.jpg','jpg');
good luck
steven dakin
-----
Steven Dakin
Institute of Ophthalmology
11-43 Bath Street
London EC1V 9EL

Lab: +44 20 7608 6988
Office: +44 20 7608 6928
Fax: +44 20 7608 6850
Web: http://www.homepages.ucl.ac.uk/~smgxscd