# How to dynamically path to image management from report?

**URL:** <https://forum.inductiveautomation.com/t/how-to-dynamically-path-to-image-management-from-report/71834>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [March 30, 2023, 2:42pm UTC](https://forum.inductiveautomation.com/t/how-to-dynamically-path-to-image-management-from-report/71834 "2023-03-30T14:42:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierce\_Thompson](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@Pierce\_Thompson](https://forum.inductiveautomation.com/u/Pierce_Thompson)\
**Post date:** [March 30, 2023, 2:42pm UTC](https://forum.inductiveautomation.com/t/how-to-dynamically-path-to-image-management-from-report/71834/1 "2023-03-30T14:42:05Z")

</div>

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,

```auto
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

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

```

error.

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?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 30, 2023, 2:44pm UTC](https://forum.inductiveautomation.com/t/how-to-dynamically-path-to-image-management-from-report/71834/2 "2023-03-30T14:44:28Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![Pierce\_Thompson](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@Pierce\_Thompson](https://forum.inductiveautomation.com/u/Pierce_Thompson)\
**Post date:** [March 30, 2023, 2:47pm UTC](https://forum.inductiveautomation.com/t/how-to-dynamically-path-to-image-management-from-report/71834/3 "2023-03-30T14:47:52Z")

</div>

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

```auto
"/system/images/image.png"
"//system//images//image.png"
"\\system\\images\\image.png"

```

results in the same error

---

<div class="post-metadata">

**Author:** ![Pierce\_Thompson](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@Pierce\_Thompson](https://forum.inductiveautomation.com/u/Pierce_Thompson)\
**Post date:** [March 30, 2023, 3:03pm UTC](https://forum.inductiveautomation.com/t/how-to-dynamically-path-to-image-management-from-report/71834/4 "2023-03-30T15:03:09Z")

</div>

The correct path format omitted

```auto
"/system/images/..."

```

to just have

```auto
"image.png"

```
