WeiWei Shu 2 Posted January 25, 2022 Share Posted January 25, 2022 Hi, I have a custom mod visualization that I'd like to export to png file with IronPython script. The script below works for a native Spotfire vis, but it failed on a mod vis. I then tried Spotfire native export button (File->Export->Visualization to image...) and it works just fine. So I believe it is achievable, can anyone help me on what API function I should use to accomplish this goal Thank you! from System.Drawing import Bitmap, Graphics, Rectangle, Point from System.Drawing.Imaging import ImageFormat for v in Document.ActivePageReference.Visuals: w, h = 100, 100 bm = Bitmap(w, h) g = Graphics.FromImage(bm) g.TextRenderingHint = g.TextRenderingHint.AntiAlias _ = v.Render(g, Rectangle(Point(0, 0), bm.Size)) fname = "G:\test.jpg" bm.Save(fname, ImageFormat.Png) Link to comment Share on other sites More sharing options...
Erik Brandin 2 Posted January 26, 2022 Share Posted January 26, 2022 Hi Weiwei, The Render method is marked obsolete and does not work for a Mod. Please use Visual.RenderAsync method instead that will work for all visualization types. An example can be found here. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now