Image Transparency in AppDesigner
이전 댓글 표시
I am building a GUI in AppDesigner, and in the static layout I have a few images. I have successfully been able to bring the gray image behind the bluer backgrouond, but I have not been able to change the transparency of the "foreground" image to show that the gray is behind it. All the tutorials I have foudn so far have been for changing transparency for image outputs, not static parts of the GUI. I would appreciate any and all help- thank you!

댓글 수: 5
Yongjian Feng
2021년 11월 17일
"foreground" image is the most up front image? Is it a png with transparent background?
Maximilian Orman-Kollmar
2021년 11월 17일
I'm just going to assume you're trying to do this composition strictly via graphics object properties instead of the raster data. Since AppDesigner is completely unusable in my environment, I'm just going to assume that something analagous works:
A = imread('peppers.png');
B = imread('cameraman.tif');
imshow(A); hold on % display BG image
hfg = imshow(B); % display FG image
hfg.AlphaData = 0.5; % set scalar alpha
Note that when you set the alpha of the BG layer, you'll be blending with the figure background.
That said, you're talking about putting the "background" sand image on top of the "foreground" projectile/probe/thing. Is that really what you want? The matting in the foreground image isn't uniform and will remain noticeable regardless of layer ordering. If these images don't need to be programatically rearranged in use, it would be simpler to just throw this in an image manipulation program and make a single image -- or to at least tidy up the FG image to aid in compositing.
Maximilian Orman-Kollmar
2021년 11월 18일
Yongjian Feng
2021년 11월 18일
Yes, I was about to suggest the same thing. If you are using uiimage, switch to UIAxes.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

