Thursday, March 24, 2016

No support for BMP with transparent color in AutoCAD 2017

Why Don't My Custom Images Display with A Transparent Color?

Starting with AutoCAD 2017-based products, the color 192,192,192 in BMP files is no longer supported as a transparent color for custom images displayed in the user interface like Ribbon and toolbars. All custom images stored in BMP files which previously used the color 192,192,192 for transparency need to be updated to PNG files (something that has been supported since AutoCAD 2015). Once updated to a PNG file, the color 192,192,192 needs to be changed to the transparent color.

The icon to the left is an old BMP icon and the color 192,192,192 now shows as the gray color it is. The icon to the right is a PNG icon with transparency showing up as expected in the Dark Color scheme.

And this with Light Color scheme.

The following outlines the general steps that need to be performed to update an existing custom image with transparency:

  1. In an image editor external to the AutoCAD-based product, open the BMP file that used the color 192,192,192 for transparency.
  2. In the image editor, set a drawing tool current and specify the current color as transparent.
  3. In the image editor window, change the pixels currently assigned the color 192,192,192 to the transparent color.
  4. Save the image as a PNG file.
  5. In the AutoCAD-based product, at the Command prompt, enter cui.
  6. In the CUI Editor, assign the PNG file to the command which was previously assigned the original BMP file that contained transparency.
  7. Save the changes made in the CUI Editor.

    The image should now display correctly in the AutoCAD user interface.

Tip 1: To simplify the conversion process of custom images, you could use a third-party image editing application that supports the ability to batch convert the images. As part of the batch process, you might be able to convert multiple BMP files to PNG files and perform a color substitution on each file as it is converted. A color substitution can be used to automatically update the color of all pixels in an image from 192,192,192 to transparent. Here are a few possible third-party image editing applications you could use:

  • ImageMagick® (http://www.imagemagick.org/) - Software suite to create, edit, compose, or convert bitmap images.
  • IrfanView (http://www.irfanview.com/) - Image viewer used to create and edit images and video files.
    Example of usage: "C:\Program Files (x86)\IrfanView\i_view32.exe" MyIcon.BMP /transpcolor=(192,192,192) /convert MyIcon.PNG
  • Cuix tools is a dedicated tool to handle this conversion.

Tip 2: After you have your PNG files you can rename them to BMP and thus you don’t need to change the names in the .cuix file.

The ADN team has posted a code snippet that can be used to convert such images too.

No comments:

Post a Comment