Saving Figure using saveas() function
Show older comments
Is there any way by which I can save the current figure?.
When I use saveas() function eg)saveas(gcf,'pred_prey.jpg') the current image in the figure gets saved but with a white background with my image centered in it.
I need only the image no need of the white background. How can I do that?
https://picasaweb.google.com/lh/photo/xxof9xl2tRBx0GttFdESBJOzMXS1UfqXPDW9N1lFu0w?feat=directlink

1 Comment
Jan
on 18 Feb 2011
The link shows a picture, but it does not clear the difference of what you get and waht you want.
Accepted Answer
More Answers (2)
Jan
on 18 Feb 2011
You can use GETFRAME and IMWRITE instead:
AxesH = gca; % Not the GCF
F = getframe(AxesH);
imwrite(F.cdata, 'pred_prey.jpg');
Doug Hull
on 18 Feb 2011
0 votes
If you have the image as a matrix that you used in IMSHOW, then IMWRITE directly on the matrix should work.
Categories
Find more on Image Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!