# Programmatically Adding Images to Image Management

**URL:** <https://forum.inductiveautomation.com/t/programmatically-adding-images-to-image-management/75652>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 28, 2023, 2:51pm UTC](https://forum.inductiveautomation.com/t/programmatically-adding-images-to-image-management/75652 "2023-06-28T14:51:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdia](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdia/32/87599_2.png) [@mdia](https://forum.inductiveautomation.com/u/mdia)\
**Post date:** [June 28, 2023, 2:51pm UTC](https://forum.inductiveautomation.com/t/programmatically-adding-images-to-image-management/75652/1 "2023-06-28T14:51:02Z")

</div>

The title says it all, is there a way to programmatically upload images to Ignition's Image Management Folder, instead of manually doing it via the designer?

---

<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:** [June 28, 2023, 4:23pm UTC](https://forum.inductiveautomation.com/t/programmatically-adding-images-to-image-management/75652/2 "2023-06-28T16:23:24Z")

</div>

> [@Image Management Tool](https://forum.inductiveautomation.com/t/image-management-tool/37558):
>
> Does anyone have an example of using the Image Management Tool to upload images from a client? Currently using version 7.9. I found the post below, but have not been even close to successful in getting it to work. [[Image Management Tool Query](http://forum.inductiveautomation.com/t/image-management-tool-query/32652)] Thanks!

Or an alternative:

> [@How to save the uploaded file in default image folder (/system/images/)?](https://forum.inductiveautomation.com/t/how-to-save-the-uploaded-file-in-default-image-folder-system-images/32771/2):
>
> This won’t work the way you’re expecting it to. The /system/images/ route handler isn’t attached to an actual folder in the gateway install directory - it’s handled entirely in code, and retrieves images from the internal database. If you want to manually upload images, you’ll need to get a reference to the ImageManager on the gateway and call insertImage manually, filling in all the appropriate fields: [com.inductiveautomation.ignition.gateway.images.ImageManager#insertImage](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/gateway/images/ImageManager.html#insertImage-java.lang.String-java.lang.String-com.inductiveautomation.ignition.gateway.images.ImageFormat-java.lang.String-byte:A-int-int-int-). Actually doing so …

---

<div class="post-metadata">

**Author:** ![Craig.Lovold](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@Craig.Lovold](https://forum.inductiveautomation.com/u/Craig.Lovold)\
**Post date:** [June 30, 2023, 6:14pm UTC](https://forum.inductiveautomation.com/t/programmatically-adding-images-to-image-management/75652/4 "2023-06-30T18:14:11Z")

</div>

I'm working with mdia here, so let me step in a bit.  
What you posted is getting closer, but a little more detail on what we are trying to accomplish might be useful. We are doing automated deployments, and we are able to push arbitrary files to the gateway during that process, so we can get the images onto the gateway server file system that way. At the end of our deployment pipeline we have a gateway script that is activated to perform updates.  
Unless I'm mistaken we need to get an instance of an ImageManager object in gateway scope that can then be used to import the images from the local gateway server file system images into the gateway image store.

My question is how can we get an instance of ImageManager in gateway scope?

---

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [June 30, 2023, 6:29pm UTC](https://forum.inductiveautomation.com/t/programmatically-adding-images-to-image-management/75652/5 "2023-06-30T18:29:10Z")

</div>

There's still some scope complexities you may need to sort out, but you're on the right track at least in current Ignition versions. I'm guessing/hoping there are going to be some updates in 8.3 as they move to a more git friendly setup for the configurations. But IA would have to comment on what the future holds.

[This](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/gateway/images/ImageManager.html#insertImage(java.lang.String,java.lang.String,com.inductiveautomation.ignition.gateway.images.ImageFormat,java.lang.String,byte%5B%5D,int,int,int)) is essentially the function you need.

[This forum post](https://forum.inductiveautomation.com/t/export-images-using-scripting/46533) was most of my reference for doing the opposite of what you did(saving images), but should hopefully help get the Gateway and Image management.

---

<div class="post-metadata">

**Author:** ![Craig.Lovold](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@Craig.Lovold](https://forum.inductiveautomation.com/u/Craig.Lovold)\
**Post date:** [June 30, 2023, 7:02pm UTC](https://forum.inductiveautomation.com/t/programmatically-adding-images-to-image-management/75652/6 "2023-06-30T19:02:15Z")

</div>

Thank you! That looks like exactly what I need.

Becoming more source control friendly would be very welcome. We're having to do a lot of gymnastics to be able to deploy UDT changes and things like that. I'm guessing that as soon as we have all the workarounds in place they'll announce built in solutions 🙂

---

<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:** [June 30, 2023, 7:40pm UTC](https://forum.inductiveautomation.com/t/programmatically-adding-images-to-image-management/75652/7 "2023-06-30T19:40:32Z")

</div>

I'll have to look into the details of how it works, but there's also a mechanism for ingress of images on disk that we use ourselves for the builtin icons. That may only run on brand new gateways, though.
