Perfectly fitting an image on a pushbutton of my GUI

조회 수: 4 (최근 30일)
Alfonso
Alfonso 2018년 6월 8일
답변: hamdah alotaibi 2019년 4월 24일
I have created a GUI where I have two pushbuttons, I have embedded an image on these pushbuttons, but as you can see there are the button images, but they have black spaces around, because the original image has them. My question is if there is an effective way of deleting those black spaces that are around of the real part of the image I want (play button and save button), so only the button part of the image appears.
I have used this code to fit the image to the pushbuttons
%Play button
[a,map]=imread('play_button.png');
[r,c,d]=size(a);
x=ceil(r/45);
y=ceil(c/60);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.play_button,'CData',g);
I have attached an image of the GUI with those 2 buttons. And I have also attached the original images of the play button and save button.

답변 (1개)

hamdah alotaibi
hamdah alotaibi 2019년 4월 24일
instead of ceil() method, use floor()
good luck :)

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by