# 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:** 1\
**Showing post:** 7

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

---

_[View the full topic](https://forum.inductiveautomation.com/t/accessing-the-image-management-tool/1792)._
