View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
addLogo - add image to container figure/panel

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

Be the first to rate this file! 3 Downloads (last 30 days) File Size: 3.33 KB File ID: #42400 Version: 1.2
image thumbnail

addLogo - add image to container figure/panel


Yair Altman (view profile)


27 Jun 2013 (Updated )

add the specified image at the specified container position; supports resizing/animated/transparent

| Watch this File

File Information

    hPanel = addLogo(filename,pixelPosition,hContainer)
    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.
    - 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
    - hPanel - handle to panel containing the image (can be resized/deleted/etc.)
    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:
Bugs and suggestions:
    Please send to Yair Altman (altmany at gmail dot com)
    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.

Required Products MATLAB
MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
08 Jul 2013 1.2

Fix for files on current folder

Contact us