# Image display from database

**URL:** <https://forum.inductiveautomation.com/t/image-display-from-database/44613>\
**Category:** Ignition\
**Created:** [March 18, 2021, 6:42am UTC](https://forum.inductiveautomation.com/t/image-display-from-database/44613 "2021-03-18T06:42:04Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [March 18, 2021, 3:28pm UTC](https://forum.inductiveautomation.com/t/image-display-from-database/44613/3 "2021-03-18T15:28:32Z")

</div>

I've successfully displayed .jpg files in a paintable canvas from a database after slightly tweaking this code.

> [@Updating Image component based off of newest image in a directory](http://forum.inductiveautomation.com/t/updating-image-component-based-off-of-newest-image-in-a-directory/14972/7):
>
> Here’s some code to display an image, scaled, on the paintable canvas. Also caches the read image to avoid a little bit of extra load: g = event.graphics filename = r"path/to/file.png" cachedName = event.source.getClientProperty("img-bytes-cached-name") bytes = event.source.getClientProperty("img-bytes-cached") if filename!=cachedName or not bytes: # Image not cached - load from database #bytes = system.db.runScalarQuery("SELECT data FROM image\_test WHERE imgname='%s'"%name) bytes = system.…

---

_[View the full topic](https://forum.inductiveautomation.com/t/image-display-from-database/44613)._
