Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Measurement Studio ToImage() Method Does Not Save Transparency

Primary Software: Measurement Studio>>Standard Edition (Starter Kit)
Primary Software Version: 8.0.1
Primary Software Fixed Version: 8.1.1
Secondary Software: N/A

Problem: I am using the Measurement Studio ToImage() method to save an image of my waveform graph. I select the image format as either .png or .gif. These file formats support transparency, but the transparency is not saved. The objects that should be transparent appear white. Why isn't the transparency being saved?

Solution: In Measurement Studio 8.1 and previous versions, the ToImage() method uses .NET built-in methods to create the image files. Unfortunately, these methods do not support transparency. However, there is a way to save images of Measurement Studio controls with transparency. Attached is a link to an example demonstrating how to use custom classes to save images with transparency.

In Measurement Studio 8.1.1, when a color in the control is set to Transparent, the returned image contains transparency information. Due to limitations in the .NET Framework, when you save an image and specify .gif as the image format, transparency is lost. Refer to Microsoft KB 318343 for information about GDI+ and .gif files saved using the 8-bpp format. However, you can save an image of the control without losing transparency. Call the ToFile or ToImage method and specify .gif or .png as the ImageType to save the image with transparency information.

Note: You cannot set BackColor of a WebForm control to transparent.


Related Links: Developer Zone Example: Saving Measurement Studio Control Images with Transparency
Microsoft Knowledgebase 318343: GDI+ GIF Files Are Saved Using the 8-bpp Format

Attachments:





Report Date: 11/06/2006
Last Updated: 08/23/2007
Document ID: 42H73MI0

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit