# Accessing the Image management tool

**URL:** <https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792>\
**Category:** Ignition\
**Created:** [April 29, 2010, 5:23am UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792 "2010-04-29T05:23:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ISDProj](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@ISDProj](https://forum.inductiveautomation.com/u/ISDProj)\
**Post date:** [April 29, 2010, 5:23am UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/1 "2010-04-29T05:23:34Z")

</div>

Is it possible to call the “Image management tool”, that is avaiable in the designer, directly from a running application?  
If not, how do I get a list of available images/thumbnails for the user to choose from or add to?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [April 29, 2010, 9:00pm UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/2 "2010-04-29T21:00:41Z")

</div>

Unfortunately, the Image Managment tool is only available in the designer. What do you want to with the tool in the client?

---

<div class="post-metadata">

**Author:** ![ISDProj](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@ISDProj](https://forum.inductiveautomation.com/u/ISDProj)\
**Post date:** [May 3, 2010, 2:44am UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/3 "2010-05-03T02:44:50Z")

</div>

We have an application that allows the “highlighting” of part of an image based on the status of that “area”. The idea of making the image manager available to the client (with suitable security that is) was so they can update/add/remove the images as needed without getting into the designer. Not that I don’t trust them, well actually… I don’t. 😒  
If this is not available to the client can you please give me some ideas as to how I can achieve similar functionality in a client window (i.e. browse, select, add, and remove images from the gateway.) ![:prayer:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e5a7e3b63facc151ea73e3b45db7bdb3d4bdc316.gif ":prayer:")

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [May 3, 2010, 6:04pm UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/4 "2010-05-03T18:04:47Z")

</div>

The only way to get that functionality right now is to put the images (image paths) in a dataset on the window. Of course, this means you need to select all of the images ahead of time. Once you have that, you can dynamically run through the images in the dataset in the client selecting the images you need. Hope this helps.

---

<div class="post-metadata">

**Author:** ![nicolas.griffon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nicolas.griffon/32/16603_2.png) [@nicolas.griffon](https://forum.inductiveautomation.com/u/nicolas.griffon)\
**Post date:** [April 29, 2021, 7:55am UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/5 "2021-04-29T07:55:26Z")

</div>

Hello @Travis.Cox ,  
I’ve the same need for a Perspective application.  
Users need to select an image to fill a form.  
For now, my image list is a manual dataset and in the futur, it would be nice to be able to list by script the image list of a folder in Image management tool.

Otherwise, I’ll have to host them elsewhere (filesystem or database) to dynamically build my dataset.

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [April 29, 2021, 10:01am UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/6 "2021-04-29T10:01:51Z")

</div>

> [@nicolas.griffon](#):
>
> Otherwise, I’ll have to host them elsewhere (filesystem or database) to dynamically build my dataset.

This is the way that is generally supported at the moment. Either by storing the files in a DB or exposing them via the WebDev module.

You can also put the images in `<Install Dir>\Inductive Automation\Ignition\webserver\webapps\main` and then pull them in via bindings etc. See [here](http://forum.inductiveautomation.com/t/display-local-image-file-in-perspective/24953/3) for more information.

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [April 29, 2021, 10:34am UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/7 "2021-04-29T10:34:10Z")

</div>

If you really want to use the image management tool, the following two scripts might help. They work in 8.1, some mods are required in the message handler for earlier versions. The methods are not supported.

Script 1 sends image data from the client to a message handler(image\_upload) on the gateway:

```auto
from java.awt import Toolkit
from java.io import File
from org.apache.commons.io import FilenameUtils
import imghdr

filepath = event.source.parent.getComponent('File Explorer').selectedPath

payload = {}
payload['image_name'] = File(filepath).name.replace(' ','')
payload['image_desc'] = None

# Valid image types PNG, JPEG, GIF, BMP, fix this in the message handler
payload['image_type'] = imghdr.what(str(filepath)).upper()

# Important to end the folder name with a /
payload['folder'] = "%s/" % folder_name

javaImage = Toolkit.getDefaultToolkit().getImage(filepath)
payload['width'] = javaImage.width
payload['height'] = javaImage.height
payload['size'] = File(filepath).length()
payload['image_data'] = system.file.readFileAsBytes(filepath)

# Call the gateway event script message handler, named image_upload on this project
proj = system.tag.read("[System]Client/System/ProjectName").value
status = system.util.sendRequest(proj, 'image_upload', payload)

```

Script 2, a gateway message handler named image\_upload, puts the image data into the image management tool:

```auto
 	from com.inductiveautomation.ignition.gateway import IgnitionGateway
 	from com.inductiveautomation.ignition.gateway.images import ImageFormat
 	
 	context = IgnitionGateway.get()
 	image = context.getImageManager()
 
 #	1 Valid image types PNG, JPEG, GIF, BMP, fix this in the message handler
 	image_type = {
 		'PNG' : ImageFormat.PNG,
 		'JPG' : ImageFormat.JPEG,
 		'JPEG': ImageFormat.JPEG,
 		'GIF' : ImageFormat.GIF,
 		'BMP' : ImageFormat.BMP}[payload['image_type']]
 
 	image.insertImage(payload['image_name'], payload['image_desc'], image_type, payload['folder'], payload['image_data'], payload['width'], payload['height'], payload['size'])
 	
 	return

```

These are also posted at [Image Management Tool - #19 by mcgheeiv](http://forum.inductiveautomation.com/t/image-management-tool/37558/19) along with a bunch of development clues.

---

<div class="post-metadata">

**Author:** ![nicolas.griffon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nicolas.griffon/32/16603_2.png) [@nicolas.griffon](https://forum.inductiveautomation.com/u/nicolas.griffon)\
**Post date:** [April 29, 2021, 12:50pm UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/8 "2021-04-29T12:50:05Z")

</div>

Thanks all for your help.

Do you know if I can use these library in a Perspective view to list all images from a folder and fill my Dataset?  
[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.1/com/inductiveautomation/ignition/gateway/images/package-summary.html](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.1/com/inductiveautomation/ignition/gateway/images/package-summary.html)

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [April 29, 2021, 3:42pm UTC](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792/9 "2021-04-29T15:42:48Z")

</div>

Yes, it is possible to access the ImageManager using the SDK API. You can get all of the images or upload new oens. For example, you can do this:

```auto
from com.inductiveautomation.ignition.gateway import IgnitionGateway
context = IgnitionGateway.get()
imageManager = context.getImageManager()

```

You can look at the JavaDocs here:

[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.1/com/inductiveautomation/ignition/gateway/images/ImageManager.html](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.1/com/inductiveautomation/ignition/gateway/images/ImageManager.html)

The script has to run on the Ignition Gateway (server) in order to access that API. Also, the API is subject to change in the future so you will want to test the script after any upgrades or track the changes in the API.
