how to position and resize an image mask on my System Composer "component" block

When I insert an image mask over my System Composer component block, the image obscures the block title and port names. I have not found a way to adjust the position and size of the image mask to avoid this. Search results give the image() command: https://www.mathworks.com/help/simulink/slref/image.html but this is for Simulink blocks, not System Composer component blocks.
I also got setMaskImage command here which is specifically for System Composer component blocks: https://www.mathworks.com/help/systemcomposer/ref/systemcomposer.arch.architecture.setmaskimage.html but it does not list adjusting position and size of the mask image.
How would I go about adjusting the System Composer component mask image to improve the look and not obscure other important block name and port names?

 Accepted Answer

Hi @Frank,
If you put this file into your userpath and restart matlab, it will add a right-click option to change the IconTransparency setting on components that you have masked. This is a work-around but I have also submitted an enhancement request to make this accessible via the GUI.
You can find your userpath by typing:
>>userpath
If you already have a file called sl_customizations in there, please send me a message because we will have to merge them
Josh

8 Comments

Hi @Josh Kahn. Thanks for the GUI work around, but not sure where to find the GUI menu for this work around. Of course I see the screen grab you attached, but still not clear.
If you right-click a component that is masked, you should see it in the context menu at the bottom
Josh
Just to be clear I did put your file in the path you designated and restarted matlab.
Try typing sl_refresh_customizations at the matlab prompt then check again
Josh
Thanks, Josh. I got the custom menu in place (called your function script from a project startup script), but selecting "opaque-with-ports" setting still consumes the full component block box (see attached image). I manually re-sized the mask_image itself and then re-added this smaller image to the component block, but it still filled the entire component block area. See attached screen grab.
Hi Frank,
I double-checked and this is a bug in R2024b Update 5 that is fixed in the next update.
Josh
Okay. Thanks. I am currently using System Composer R2024b Update 4 (Version 24.2.)

Sign in to comment.

More Answers (1)

Hi Frank,
When setting the mask image for System Composer component block using ‘setMaskImage’ function, use ‘IconTransparency’ input argument and set it to ‘opaque-with-ports’ to ensure that the image does not obscure the port and block name.
Syntax:
comp.Architecture.setMaskImage(FilePath="Filepath", IconTransparency="opaque-with-ports");
Appearance before and after specifying the Icon Transparency argument:
Hope it helps.

1 Comment

Thanks for the response, but I do not know enough about programmatically working with System Composer architecture models. I am pretty good with matlab commands for data processing and some Simulink model settings but not with System Composer or Simscape, at least yet. Glad to know Math Works implemented a way to adjust the image mask. So I don't spend another hour+ on trying to resolve this (it should be a <10 sec operation), are you aware of a straight-forward GUI approach? With the model open I click the FORMAT tab and see nothing under the "Edit Image" menu drop down or when I use the "Edit Block icon image" insert mask image click-flow. Nor can I find any menu command when I select the system composer component block and click-right to see the pop-up menu choices. I looked under "Format" and "Properties"...nothing. Lastly, I also checked under the component's PropertyInspector...nothing.

Sign in to comment.

Categories

Find more on System Composer in Help Center and File Exchange

Products

Release

R2024b

Asked:

on 24 Feb 2025

Edited:

on 14 Mar 2025

Community Treasure Hunt

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

Start Hunting!