Imtile resolution changes with figure height
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jason
el 13 de Nov. de 2025
Comentada: Jason
el 14 de Nov. de 2025
Hello, Im using imtile to create a montage from an array of images
out=imtile(IMarray,'GridSize',[r c]);
I display this on a fig via:
fig = uifigure('Name',['Montage ',char(tl)]);
fig.HandleVisibility='on';
fig.Position = [300 200 figW figH];
m = uimenu(fig,Label="My Save As");
m.MenuSelectedFcn = @app.mysavefunc;
app.figMontage=fig; % assign to public property so can be accessed
g = uigridlayout(fig);
%Create 3 x 2 Grid Layout
g.RowHeight = {'9x','1x','1x','1x'}; % g.RowHeight = {'6x','6x','1x','1x'};
g.ColumnWidth = {'1x','1x','1x','16x','0.8x'}; %g.ColumnWidth = {'1x','8x'};
%add UIAXES to 1st 2 rows, 1st 2columns
app.axMontage = uiaxes(g);
app.axMontage.Layout.Row = [1,2];
app.axMontage.Layout.Column = [1 5];
myImagesc(app,app.axMontage,out); axis(app.axMontage,'image'); drawnow;
So Ive noticed when y figure is 1500 x 600, the images look a lot better than when the figure is only 300 high - even though with the 300 height figure, the montage completely fits


2 comentarios
DGM
el 14 de Nov. de 2025
Editada: DGM
el 14 de Nov. de 2025
It might be worth noting that the default behavior for imtile() sets the tile size to the geometry of the first image. If your images vary in size and you don't want any of them downsampled in the operations internal to imtile(), then you need to explicitly set ThumbnailSize in the call to imtile().
It's not really obvious from the example if your images do vary, but I figured I'd throw that out there.
Like Matt said though, even if there isn't any downsampling happening in the output of imtile(), if the composite image size exceeds the displayed size, then it must be downsampled for display.
Depending on what tool you're using to display the composite image (imshow() vs image()/imagesc()), the display interpolation is likely nearest-neighbor. That tends to accentuate aliasing in images with small features and hard edges. While imshow() supports bilinear display interpolation, it's not the default. See imshow. It might help ease some of the appearance, but if the image is being downsampled for display, it doesn't change the fact that it's being downsampled.
Respuesta aceptada
Matt J
el 13 de Nov. de 2025
So Ive noticed when y figure is 1500 x 600, the images look a lot better than when the figure is only 300 high - even though with the 300 height figure, the montage completely fits
The montage will always fit, independently of the height of the figure. However, as the figure dimensions gets smaller, it forces the renderer to downsample your image to make it occupy fewer pixels, and that will of course degrade the appearance of the image.
3 comentarios
Matt J
el 14 de Nov. de 2025
Editada: Matt J
el 14 de Nov. de 2025
You can do,
g.RowHeight = {400,'1x','1x','1x'};
though keep in mind that this sets the first row to 400 logical pixels, not hardware pixels. On Windows systems, a logical pixel is always 1/96 inches,
Maybe you should consider imresizing by a smaller factor, e.g., to 800x800 and using a different interpolation method as @DGM mentions. Then you don't have to worry so much about how visual quality depends on the figure size.
Más respuestas (0)
Ver también
Categorías
Más información sobre Basic Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!