There are 3 things to take care of in order to display image in its original size (1:1):
- The figure size and units.
- The axes size and units.
- The axes data aspect ratio.
Once all of that are set according to the image size even using MATLAB's image()
function one could generate 1:1 display of an image.
Here is the sample code:
%% Load Data
mI = imread('7572939538_04e373d8f4_z.jpg');
numRows = size(mI, 1);
numCols = size(mI, 2);
%% Setings
horMargin = 30;
verMargin = 60; %<! Title requires more
%% Display Image
vFigPos = [100, 100, numCols + (2 * horMargin), numRows + (2 * verMargin)]; %<! [Left, Bottom, Width, Height]
vAxesPos = [horMargin, verMargin, numCols, numRows];
hFigure = figure('Position', vFigPos, 'Units', 'pixels');
hAxes = axes('Units', 'pixels', 'Position', vAxesPos);
hImageObj = image(hAxes, mI);
set(hAxes, 'DataAspectRatio', [1, 1, 1]);
set(get(hAxes, 'Title'), 'String', {['Landscape by Roman Vanur']}, ...
'Fontsize', fontSizeTitle);
set(hAxes, 'XTick', []);
set(hAxes, 'YTick', []);
The result (Based on the image - Landscape by Roman Vanur):

The full code in my Stack Overflow Q1427602 Github Repository.