<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246232</link>
    <title>MATLAB Central Newsreader - imwrite</title>
    <description>Feed for thread: imwrite</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 09 Mar 2009 17:25:03 -0400</pubDate>
      <title>imwrite</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246232#633541</link>
      <author>Oluwa KuIse</author>
      <description>Hello,&lt;br&gt;
Can anyone please help me out with the imwrite function.&lt;br&gt;
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?&lt;br&gt;
Thank you all.&lt;br&gt;
Oluwa KuIse</description>
    </item>
    <item>
      <pubDate>Mon, 09 Mar 2009 17:27:12 -0400</pubDate>
      <title>Re: imwrite</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246232#633543</link>
      <author>Peter Boettcher</author>
      <description>&quot;Oluwa KuIse&quot; &amp;lt;wespeakforex@yahoo.com&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
&amp;gt; Hello, Can anyone please help me out with the imwrite function.  When&lt;br&gt;
&amp;gt; I use it, it creates the file quite alright but it doesn't display the&lt;br&gt;
&amp;gt; image. I have tried it with both the .png and .jpeg formats. Any&lt;br&gt;
&amp;gt; suggestions? &lt;br&gt;
&lt;br&gt;
What problem are you having?  imwrite is supposed to create the file.&lt;br&gt;
It is not supposed to display anything.  Are you looking for image() or&lt;br&gt;
imshow() instead?  Or would you specifically like to do something with&lt;br&gt;
the image file after it is written?&lt;br&gt;
&lt;br&gt;
-Peter</description>
    </item>
    <item>
      <pubDate>Mon, 09 Mar 2009 18:47:01 -0400</pubDate>
      <title>Re: imwrite</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246232#633568</link>
      <author>Oluwa KuIse</author>
      <description>Peter Boettcher &amp;lt;boettcher@ll.mit.edu&amp;gt; wrote in message &amp;lt;muy63iili8f.fsf@G99-Boettcher.llan.ll.mit.edu&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Oluwa KuIse&quot; &amp;lt;wespeakforex@yahoo.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Hello, Can anyone please help me out with the imwrite function.  When&lt;br&gt;
&amp;gt; &amp;gt; I use it, it creates the file quite alright but it doesn't display the&lt;br&gt;
&amp;gt; &amp;gt; image. I have tried it with both the .png and .jpeg formats. Any&lt;br&gt;
&amp;gt; &amp;gt; suggestions? &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What problem are you having?  imwrite is supposed to create the file.&lt;br&gt;
&amp;gt; It is not supposed to display anything.  Are you looking for image() or&lt;br&gt;
&amp;gt; imshow() instead?  Or would you specifically like to do something with&lt;br&gt;
&amp;gt; the image file after it is written?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -Peter&lt;br&gt;
&lt;br&gt;
Hi, Peter,&lt;br&gt;
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:&lt;br&gt;
source_color = im2uint8([.5 .5 1]);&lt;br&gt;
E = im2uint8(mat2gray(E));&lt;br&gt;
red = E;&lt;br&gt;
green = E;&lt;br&gt;
blue = E;&lt;br&gt;
red(BW) = source_color(1);&lt;br&gt;
green(BW) = source_color(2);&lt;br&gt;
blue(BW) = source_color(3);&lt;br&gt;
rgb_bottom = cat(3, red, green, blue);&lt;br&gt;
imshow(rgb_bottom, 'InitialMag', 'fit')&lt;br&gt;
&lt;br&gt;
% Make a second RGB image that is a constant green.&lt;br&gt;
rgb_top = zeros(size(M,1), size(M,2), 3, 'uint8');&lt;br&gt;
rgb_top(:,:,2) = 255;&lt;br&gt;
&lt;br&gt;
% Turn the influence or dependence map into an AlphaData channel to be used&lt;br&gt;
% to display with the green image.&lt;br&gt;
M(BW) = 0;&lt;br&gt;
M = imadjust(mat2gray(M), [0 1], [0 .6], 0.5);&lt;br&gt;
&lt;br&gt;
image('CData', rgb_top, 'AlphaData', M);&lt;br&gt;
&lt;br&gt;
Question: Image() displays the image in a MATLAB figure window. I want to be able to display this image in say, .jpeg. &lt;br&gt;
Thank you!</description>
    </item>
    <item>
      <pubDate>Mon, 09 Mar 2009 19:15:15 -0400</pubDate>
      <title>Re: imwrite</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246232#633575</link>
      <author>Peter Boettcher</author>
      <description>&quot;Oluwa KuIse&quot; &amp;lt;wespeakforex@yahoo.com&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
&amp;gt; Peter Boettcher &amp;lt;boettcher@ll.mit.edu&amp;gt; wrote in message &amp;lt;muy63iili8f.fsf@G99-Boettcher.llan.ll.mit.edu&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; &quot;Oluwa KuIse&quot; &amp;lt;wespeakforex@yahoo.com&amp;gt; writes:&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; Hello, Can anyone please help me out with the imwrite function.  When&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; I use it, it creates the file quite alright but it doesn't display the&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; image. I have tried it with both the .png and .jpeg formats. Any&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; suggestions? &lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; What problem are you having?  imwrite is supposed to create the file.&lt;br&gt;
&amp;gt;&amp;gt; It is not supposed to display anything.  Are you looking for image() or&lt;br&gt;
&amp;gt;&amp;gt; imshow() instead?  Or would you specifically like to do something with&lt;br&gt;
&amp;gt;&amp;gt; the image file after it is written?&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; -Peter&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hi, Peter,&lt;br&gt;
&amp;gt; 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:&lt;br&gt;
&amp;gt; source_color = im2uint8([.5 .5 1]);&lt;br&gt;
&amp;gt; E = im2uint8(mat2gray(E));&lt;br&gt;
&amp;gt; red = E;&lt;br&gt;
&amp;gt; green = E;&lt;br&gt;
&amp;gt; blue = E;&lt;br&gt;
&amp;gt; red(BW) = source_color(1);&lt;br&gt;
&amp;gt; green(BW) = source_color(2);&lt;br&gt;
&amp;gt; blue(BW) = source_color(3);&lt;br&gt;
&amp;gt; rgb_bottom = cat(3, red, green, blue);&lt;br&gt;
&amp;gt; imshow(rgb_bottom, 'InitialMag', 'fit')&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % Make a second RGB image that is a constant green.&lt;br&gt;
&amp;gt; rgb_top = zeros(size(M,1), size(M,2), 3, 'uint8');&lt;br&gt;
&amp;gt; rgb_top(:,:,2) = 255;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % Turn the influence or dependence map into an AlphaData channel to be used&lt;br&gt;
&amp;gt; % to display with the green image.&lt;br&gt;
&amp;gt; M(BW) = 0;&lt;br&gt;
&amp;gt; M = imadjust(mat2gray(M), [0 1], [0 .6], 0.5);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; image('CData', rgb_top, 'AlphaData', M);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Question: Image() displays the image in a MATLAB figure window. I want to be able to display this image in say, .jpeg. &lt;br&gt;
&amp;gt; Thank you!&lt;br&gt;
&lt;br&gt;
Ah.  Use &quot;saveas&quot; or &quot;print&quot; to take a snapshot of your figure window&lt;br&gt;
and export it to a file.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
-Peter</description>
    </item>
    <item>
      <pubDate>Mon, 09 Mar 2009 19:53:01 -0400</pubDate>
      <title>Re: imwrite</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246232#633587</link>
      <author>Adam </author>
      <description>&quot;Oluwa KuIse&quot; &amp;lt;wespeakforex@yahoo.com&amp;gt; wrote in message &amp;lt;gp3o75$rr7$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; Question: Image() displays the image in a MATLAB figure window. I want to be able to display this image in say, .jpeg. &lt;br&gt;
&amp;gt; Thank you!&lt;br&gt;
&lt;br&gt;
You probably need to scale your data.  imwrite() clips everything outside the range [0, 1]&lt;br&gt;
&lt;br&gt;
% compare these two &lt;br&gt;
imwrite(magic(100), 'test.jpg')&lt;br&gt;
imwrite(magic(100)/100^2, 'test2.jpg')&lt;br&gt;
&lt;br&gt;
~Adam</description>
    </item>
  </channel>
</rss>

