How to display a transparent image in a UIFigure

5 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2018 年 3 月 2 日
編集済み: MathWorks Support Team 2024 年 1 月 23 日
What is the best way to display an image with transparency in a UIFigure ? 

採用された回答

MathWorks Support Team
MathWorks Support Team 2024 年 1 月 23 日
編集済み: MathWorks Support Team 2024 年 1 月 23 日
It is possible to display a transparent image by using a UIAxes object and by making sure to retain the alpha data when reading and displaying the image. The code bellow shows an example on how this can be achieved:
fig = uifigure;
ax = uiaxes(fig);
[imdata, ~, imalpha] = imread('myimage.png');
image(imdata, "AlphaData", imalpha, "Parent", ax);
ax.Visible = "off";
It is then possible customize the axes further (for instance "ax.Position" allows to set the positions and dimensions of the image). The following page of the documentation lists the UIAxes properties that can be used: 
https://www.mathworks.com/help/matlab/ref/matlab.ui.control.uiaxes-properties.html

その他の回答 (0 件)

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by