MATLAB: Difference Between saveas and print Commands

differenceMATLABprintsaveas

Why are image dimensions different when using saveas and print commands? Figure size is set to 560×420. Command saveas(1,'sa_01','bmp') yields image correct in size. Command print(1,'-dbmp256','pr_01.bmp') yields image incorrect in size – 576×432.

Best Answer

PRINT with the dbmp256 device use other coordinates than e.g. the dbmp device. Just set a breakpoint in PRINT and find the line, which changes the units to points and use the PaperPosition value as output size.
FigH = figure;
set(FigH, 'PaperUnits', 'points',
'PaperPosition', [18, 180, 560, 420]);
print(FigH, 'pr_01.bmp', '-dbmp256', '-r100')
This creates a 560 x 420 pixel bmp.