1. The Glitch – Distracting White Background on Custom Library Images
The image library in SOLIDWORKS Composer is a great way to quickly and easily prompt the viewer to take some action. We have convenient icons that indicate that the user may need to take caution, apply glue, or use safety equipment. But are we restricted to what comes pre-loaded? Absolutely not! All you need is a bitmap image (BMP) of the icon you’d like to use. However, if you’ve ever tried to add your own icon, you’ve probably noticed that it doesn’t look quite as clean as the pre-loaded ones due to the white background. This is a major pet peeve of mine. If you caught my earlier tech tip on saving images out of SW with an alpha channel, you have a leg up here on understanding how to fix this. If you missed that one, you can check it out HERE. It’s the same concept here, but it doesn’t quite work the same with the BMP files. All we need to do is use a little trick to pre-mask the image using Photoshop or GIMP. Here’s how it works.
2. The Switch – Pre-Mask the Image
Any image saved as a BMP file can be added to the Library folder in Windows, this is probably in your Install Directory> SOLIDWORKS Composer>Images. (Your install directory is likely something similar to: C:\Program Files\SOLIDWORKS Corp 201X.) A standard BMP file however, just looks unfished with its white background.
Luckily, there’s an easy fix that will take seconds and will clean up your documents going forward! I use Photoshop but GIMP is a free alternative. With the BMP open, we need to access the images “Channels.”
Our goal here is to add a channel to the image that will allow us to tell it what to hide. We just need to use the most appropriate selection tool to create a selection of what we want to show. I most often use the magic wand and I’ll turn off continuous where necessary to get a quick color selection. Keep in mind that in certain scenarios, it may be easier to select what you don’t want and invert the selection.
Once we have the selection made, create a mask in the “Channels” pane. If you don’t see the “Channels” pane, make sure it is checked under Window>Channels. Now we should see an “alpha channel” show up here. Remember that “alpha” means it is controlling transparency.
There’s one last critical step and that is to make sure our BMP is storing the information we just created. In “save-as” make sure the check box is selected to save alpha (if there is one available). This will change the BMP to a 32bit image, in effect, storing more data in the image.
That’s it! Our new image can be used from now on and will be clean and pre-masked every time we want to use it! Just don’t forget to refresh your Library if you already had it open. I usually navigate to the “Widgets” folder and back for a quick update.
If you don’t have an image you’d like to use, that’s no problem either. One of my favorite techniques is to grab a model from your favorite online database, drop it in SOLIDWORKS Visualize, use a 1:1 image size, turn off floor shadows, and save it as a PNG with an alpha channel. We can then use the alpha channel in the PNG to create the mask for the BMP file. And within minutes, you have a drag-and-drop image you can use in every future document you create!
3. The Takeaway – A Quick Solution Worth the Time Investment
The Image library is a great way to add information quickly and effectively in Composer. Now you know how easy it is to create great-looking custom images to add to tailor the Library to your needs. With some simple pre-masking and the correct export settings, we were able to clean up existing images or create images from scratch. These images will speed up your work in Composer and can be used over and over again with quality results. Thanks for stopping by, and we’ll see you back for the next tip!
Would you like one-on-one help with SOLIDWORKS Composer?
Would you like us to give you some one-on-one help with something in SOLIDWORKS? If you have seen any of our videos than you know that we have an extremely talented team of engineers who are passionate about what they do. Contact us today for more information on our consulting services!