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 Comments

"foreground" image is the most up front image? Is it a png with transparent background?
the "foreground" image the blue-gray picture behind the gray image in what I have posted. This is how the UI looks right now:
The gray image is completely behind now, so I want to change the transparency of what is currently up front (this picture of the sand) so that it is clear that there is another image behind it
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.
DGM thats a good point about just making it a single image, I had not thought about that. Thank you! I'll try both solutions you offered
Yes, I was about to suggest the same thing. If you are using uiimage, switch to UIAxes.

Sign in to comment.

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!