addLogo - add image to container figure/panel
Syntax:
hPanel = addLogo(filename,pixelPosition,hContainer)
Description:
addLogo(filename) adds the image specified by filename to the top-left position in the current figure.
All the standard image types recognized in modern browsers (HTML) are accepted, including GIF, JPG and PNG. Animated GIFs and transparent images are also accepted. Note that transparent images will show the container's background, but not any axes or control that lie between the container and the image.
addLogo(filename,pixelPosition) adds the image to the current figure, at the position specified by pixelPosition. Both relative and absolute positions are supported, as well as image resizing.
addLogo(filename,pixelPosition,hContainer) adds the image to the specified container, which is a handle to a figure/panel/etc.
Inputs:
- filename (mandatory): name of logo image file (full or relative path)
- pixelPosition (optional): position in parent container: [X,Y,W,H]
default value = [1,0,0,0], i.e. top-left corner of container
empty pixelPosition ([]) means to use the default value (=[1,0,0,0])
X value can be <=0, meaning left from container's right edge
Y value can be <=0, meaning below container's top edge
Width/Height values are optional (default=0)
Width/Height values can be 0, meaning the image's actual width/height
Width/Height values can be negative, meaning resized from image size
Width/Height values can be positive, meaning resized to specified size
[1,0,0,0] = top-left corner of container (default value)
[1,1,0,0] = bottom-left corner of container
[0,0,0,0] = top-right corner of container
[0,1,0,0] = bottom-right corner of container
- hContainer (optional): handle to parent container. default=gcf
Outputs:
- hPanel - handle to panel containing the image (can be resized/deleted/etc.)
Example:
addLogo('image.jpg'); % add image at top-left of current figure
addLogo('image.jpg',[]); % same as above
addLogo('image.jpg',[1,0]); % same as above
addLogo('image.jpg',[1,0,0,0],gcf); % same as above
addLogo('logo.png',[0,1]); % add image at bottom-right of current figure
addLogo('logo.png',[90,230]); % add image at position X=90, Y=230
addLogo('logo.png',[90,230,50,85]); % add 50x85 resized image at 90,230
addLogo('abc.gif',[-10,-10,50,85]); % add 50x85 resized image at top-right
addLogo('abc.gif',[],hPanel); % add at top-left of containing hPanel
Technical Description:
See http://UndocumentedMatlab.com/blog/displaying-animated-gifs
Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)
Limitations:
In some cases Matlab may require the containing figure to be visible for addLogo to work. This is not always the case, so check this issue on your specific platform / application.
인용 양식
Yair Altman (2024). addLogo - add image to container figure/panel (https://www.mathworks.com/matlabcentral/fileexchange/42400-addlogo-add-image-to-container-figure-panel), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- Image Processing and Computer Vision > Image Processing Toolbox > Image Filtering and Enhancement > Image Arithmetic >
- MATLAB > Graphics > Images > Read, Write, and Modify Image >
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!