from Web Deployment Using MATLAB by Todd Flanagan
A web-based gene analysis demonstration using MATLAB Builder for COM

getBitMap(f)
function imageData = getBitMap(f)
    % Make correct settings for the pixel to dpi transformation
    set(f,'PaperUnits','inches');
    resolution = get(0, 'screenp');

    % redraw the image using dpi resolution
    pos = get(f, 'position');
    set(f,'PaperPosition', pos ./ (resolution));

    % Create the output filename
    imageData = hardcopy(f, ['-dopengl'], ['-r96']);
    

Contact us at files@mathworks.com