How to load an image from file and display via a document property in Spotfire® using IronPython scripting
Article Information
Article Information
Code sample
# Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license. from System.IO import MemoryStream, SeekOrigin from System.Drawing import Image from System.Drawing.Imaging import ImageFormat from Spotfire.Dxp.Data import BinaryLargeObject imgSrc = "C:\\Users\\USERNAME\\Pictures\\someImage.png" img = Image.FromFile(imgSrc) stream = MemoryStream() img.Save(stream, ImageFormat.Png) stream.Seek(0, SeekOrigin.Begin) blob = BinaryLargeObject.Create(stream) # Document Property should be of type Binary Document.Properties["PngImage"] = blob
References
- API Reference: Spotfire Analyst
- API Reference: BinaryLargeObject Class
- API Reference: MemoryStream Class
License: TIBCO BSD-Style License
Recommended Comments
There are no comments to display.