File Exchange

image thumbnail

Save figure to file, choose the dimensions and crop figure

Save figure to file. Choose the dimensions and crop figure (remove homogeneous edges).


Updated 15 Jul 2014

View License

fig_print(fig,figname,dim,crop,magn_factor, bg_color)

- FIG: figure handle
- FIGNAME: file name, including extension (BMP, JPG, PNG or TIF)
- DIM: 1x2 numeric array with the image dimensions. If DIM=[], the current figure size times MAGN_FACTOR will be used.
- CROP: 1 (crop image) or 0 (do not crop [default]). Remove homogeneous edges
- MAGN_FACTOR: magnification factor (any positive number). Only effective when DIM=[]. Default: 1
- BG_COLOR : If specified, the figure window background color will be changed. You can specify a color using a three-element vector of RGB values or one of the MATLAB predefined names (short name: 'y', 'm', 'c', 'r', 'g', 'b', 'w', 'k')

- FIGNAME in the current folder or in the folder specified by its path. The file format depends on the given extension.

Cite As

Guilherme Coco Beltramini (2020). Save figure to file, choose the dimensions and crop figure (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

I liked it, however it would be better if it would work with a single function


very useful. Thanks!


Added the option to change the figure background color

Added screenshot

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags