Apply transparent background to a figure
Show older comments
I want to apply only to the background (white) of the figure "background.png" a certain level of transparency (thus keeping the pixels black).
This figure then needs to overlap with the "background_pink.png" figure.
I am using the following code:
figure();
folder_immagine_png = 'C:\...';
filename_png = 'background_pink.png';
ful_file_png = fullfile(folder_immagine_png,filename_png);
imshow(ful_file_png)
hold on
figure();
folder_immagine = 'C:\....';
filename = 'background.png';
ful_file = fullfile(folder_immagine,filename);
imshow(ful_file)
hold off
I have tried using the AlphaData command but to no avail.
4 Comments
Jan
on 2 Nov 2022
It is not getting clear to me, what this means: "I want to apply only to the background (white) of the figure "background.png" a certain level of transparency (thus keeping the pixels black)."
What is the wanted output? A displayed image on the screen or another file? What do you want to see through the transparent parts?
Alberto Acri
on 2 Nov 2022
Matt J
on 2 Nov 2022
"What is the wanted output? A displayed image on the screen or another file?"
Alberto Acri
on 2 Nov 2022
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic 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!

