[SPAM:#####] intelligently trimming a figure

If I generate a figure, without knowing, a priori, what the size of the actual plotted contents (plot, axes, colorbar, etc.) will take up, is there an efficient way to figure out that size and then trim the figure?

-gideon