How to dynamically path to image management from report?

Hello everyone,
How would I dynamically path to an image in the image management tool to be displayed on a report?

The documentation seems to suggest that you can either drag images from the image manager (this isn't dynamic) or use a byte array data source as the data key.

I started with the naive approach of having the image path as a parameter, then setting that parameter as the data key of the image component. This didn't work.

The next attempt was to create a scripted data source,

from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.gateway.images import ImageRecord
context = IgnitionGateway.get()
imageManager = context.getImageManager()

# data['image_path'] = "//system//images//image.png"
imageData = imageManager.getImage(data['image_path'])
imageBytes = imageData.getBytes(ImageRecord.Data)
data['imageBytes'] = imageBytes

However, this results in a

AttributeError: 'NoneType' object has no attribute 'getBytes'


I'm assuming the scripting is close, as the error occurs after the imageManager is instantiated, and the file path formatting is probably incorrect.
Is this something that can be done?

ImageData is null--your path is wrong for the .getImage() method. (Why are you doubling the forward slashes? That is only needed for backslashes in brain-dead Windows filesytem paths.)

1 Like

that happened to be the last attempt at modifying the file path, any combination of


results in the same error

The correct path format omitted


to just have

1 Like