TakeAPicture

Take a snapshot of the current figure, save it as a png (or tiff or whatever) image
449 Downloads
Updated 18 Apr 2011

View License

Example Usage

>>ezplot(@(t)max(30*365*24-t,0),[0 33*365*24]);
>> xlabel 'age (hours)', ylabel 'what remains of your youth (hours)';
>>TakeAPicture -report

Documentation:
% Create and save a png picture from your figure.
%
% e.g.
% TakeAPicture % Take a picture
% TakeAPicture -inv % Take a picture and invert the colors
% TakeAPicture -auto % Use a default name and directory
% TakeAPicture('name','aaa','manualcrop',false) % Specify the name and don't crop
% TakeAPicture('-withfig','name','aaa') % Also save the .fig file and specify the name
% TakeAPicture('-withfig','colors','inv') % Also save the .fig file and invert colors
%
% Settings (enter as property-value pairs)
% 'name' : Name of picture (default: <timestamp>)
% 'destination' : Save location (default: cd)
% 'figure' : Figure handle (default: gcf)
% 'invert' : whether to invert (default: false)
% 'figsave' : whether to also save the figure (default: false)
% 'uidir' : whether to use user-selected directory (default: true)
% 'manualcrop' : whether to manually crop the image (default: true)
% 'hidecontrols': whether to hide ui controls (default: false)
% 'colors' : how to modify colors. Make a cell array to do multiple
% operations. Options are:
% 'inv' : invert colors
% 'grey' : sets colors to greyscale
% 'bw' : black and white
% 'decolor' : greys out the extreme colors.
% 'normal' : does nothing
%
% Enjoy
% -Peter

Cite As

Peter O'Connor (2024). TakeAPicture (https://www.mathworks.com/matlabcentral/fileexchange/31091-takeapicture), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Printing and Saving in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0