Message 1 of 3
Export PNG with transparent background via VBA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Trying to export png with a transparent background via VBA and having some trouble . If I export with the background, I get a nice image:
If I set ("TransparentBackground") = True, and leave everything else the same, I get the transparent background but the image is very pixelated.
Anybody have any idea why this would happen? I'm running Inventor 2024. Thanks for the help!
Relevant part of the export code:
'Get the active view.
Dim oView As view
Set oView = ThisApplication.ActiveView
'configure view for export
oView.DisplayMode = DisplayModeEnum.kWireframeNoHiddenEdges
oView.ShowGroundReflections = False
oView.ShowGroundShadows = False
oView.ShowAmbientShadows = False
oView.ShowObjectShadows = False
Dim camera As camera
Set camera = oView.camera
camera.Fit
camera.Apply
'Create a new NameValueMap Object
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.value("TransparentBackground") = True
Call oView.SaveAsBitmapWithOptions(pngFileName, 800, 0, oOptions)