Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: imwrite
Date: Mon, 9 Mar 2009 18:47:01 +0000 (UTC)
Organization: University of Arkansas
Lines: 41
Message-ID: <gp3o75$rr7$1@fred.mathworks.com>
References: <gp3jdf$1sn$1@fred.mathworks.com> <muy63iili8f.fsf@G99-Boettcher.llan.ll.mit.edu>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1236624421 28519 172.30.248.37 (9 Mar 2009 18:47:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 9 Mar 2009 18:47:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1514105
Xref: news.mathworks.com comp.soft-sys.matlab:523561


Peter Boettcher <boettcher@ll.mit.edu> wrote in message <muy63iili8f.fsf@G99-Boettcher.llan.ll.mit.edu>...
> "Oluwa KuIse" <wespeakforex@yahoo.com> writes:
> 
> > Hello, Can anyone please help me out with the imwrite function.  When
> > I use it, it creates the file quite alright but it doesn't display the
> > image. I have tried it with both the .png and .jpeg formats. Any
> > suggestions? 
> 
> What problem are you having?  imwrite is supposed to create the file.
> It is not supposed to display anything.  Are you looking for image() or
> imshow() instead?  Or would you specifically like to do something with
> the image file after it is written?
> 
> -Peter

Hi, Peter,
Thanks for your fast response. What I want to do is for MATLAB to be able to display my image in any file I want outside of MATLAB. The results (images) are to be displayed elsewhere and not on MATLAB's figure window. These are the last lines of the program:
source_color = im2uint8([.5 .5 1]);
E = im2uint8(mat2gray(E));
red = E;
green = E;
blue = E;
red(BW) = source_color(1);
green(BW) = source_color(2);
blue(BW) = source_color(3);
rgb_bottom = cat(3, red, green, blue);
imshow(rgb_bottom, 'InitialMag', 'fit')

% Make a second RGB image that is a constant green.
rgb_top = zeros(size(M,1), size(M,2), 3, 'uint8');
rgb_top(:,:,2) = 255;

% Turn the influence or dependence map into an AlphaData channel to be used
% to display with the green image.
M(BW) = 0;
M = imadjust(mat2gray(M), [0 1], [0 .6], 0.5);

image('CData', rgb_top, 'AlphaData', M);

Question: Image() displays the image in a MATLAB figure window. I want to be able to display this image in say, .jpeg. 
Thank you!