how to make image transparent
조회 수: 27 (최근 30일)
이전 댓글 표시
I have an image like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195621/image.jpeg)
I want to make it transparent with a degree of transparency variable.
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 9월 11일
For example,
im = image(YourRGBImage);
for K = 0 : 20
set(im, 'AlphaData', K/20);
drawnow();
end
The form I used is for the case where you have the same transparency for the entire image. If you want to vary the transparency at different locations, then instead of setting the AlphaData to be a scalar, set it to be a double array with the same number of rows and columns as the image. Alpha of 0 is fully transparent and value of 1 is fully solid. (Do not use boolean for alpha data: MATLAB will complain about that.)
참고 항목
카테고리
Help Center 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!