title: How can I modify an image without showing it?
body: <p>I have a code that loads an image to a plot, draws a rectangle on it an after this saves the image into a png file:</p>
  
  <pre><code>    figure('Visible', 'off');
      imshow(im)
      hold on
      for n=1:size(windowCandidates,1)
          rectangle('Position',[x,y,w,h],'EdgeColor','g','LineWidth',2)
      end
      f=getframe;
      [img_bound,map]=frame2im(f);
      imwrite(img_bound, strcat(directory, 'name.', 'png')); 
      hold off
  </code></pre>
  
  <p>How can I do the same without displaying it in a figure? Just modifying it and saving, I dont want the user to see all this process)</p>
  
  <p>Thanks!</p>