# Display an alternate Image if ImagePath is invalid - Image Component - Vision

**URL:** <https://forum.inductiveautomation.com/t/display-an-alternate-image-if-imagepath-is-invalid-image-component-vision/72597>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [April 18, 2023, 6:58pm UTC](https://forum.inductiveautomation.com/t/display-an-alternate-image-if-imagepath-is-invalid-image-component-vision/72597 "2023-04-18T18:58:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathan\_Guindon\_Duroc](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nathan\_Guindon\_Duroc](https://forum.inductiveautomation.com/u/Nathan_Guindon_Duroc)\
**Post date:** [April 18, 2023, 6:58pm UTC](https://forum.inductiveautomation.com/t/display-an-alternate-image-if-imagepath-is-invalid-image-component-vision/72597/1 "2023-04-18T18:58:55Z")

</div>

Hey, I am trying to display an alternate image when the Image path is invalid. I haven't found a way to do this, Quality doesn't seem to change even if path is invalid. System.file.fileExists doesn't seem to work with Images.

Only thing i found was this but it wasn't very helpful : [Image Doesn't Exist - Vision Image Component](https://forum.inductiveautomation.com/t/image-doesnt-exist-vision-image-component/27600)

Any lead would be appreciated!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 18, 2023, 7:21pm UTC](https://forum.inductiveautomation.com/t/display-an-alternate-image-if-imagepath-is-invalid-image-component-vision/72597/2 "2023-04-18T19:21:34Z")

</div>

It's a little hacky, but it is possible to check if the image component is in an error state:

```python
from com.inductiveautomation.ignition.client.images import PathIcon
from org.apache.commons.lang3.reflect import FieldUtils
errorImage = FieldUtils.readStaticField(PathIcon, "errorImage", True)

target = event.source.parent.getComponent('Image')

print errorImage
print target.icon.image
print target.icon.image != errorImage

```

---

<div class="post-metadata">

**Author:** ![Nathan\_Guindon\_Duroc](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nathan\_Guindon\_Duroc](https://forum.inductiveautomation.com/u/Nathan_Guindon_Duroc)\
**Post date:** [April 19, 2023, 11:32am UTC](https://forum.inductiveautomation.com/t/display-an-alternate-image-if-imagepath-is-invalid-image-component-vision/72597/3 "2023-04-19T11:32:00Z")

</div>

Thank you very much mister Griffith, you are a life saver!
