from java.awt import Toolkit
from java.io import File
from org.apache.commons.io import FilenameUtils
from com.inductiveautomation.ignition.designer.gateway import DTGatewayInterface
gi = DTGatewayInterface.instance
filepath = system.file.openFile()
if filepath is not None:
name = File(filepath).name
javaImage = Toolkit.defaultToolkit.getImage(filepath)
gi.uploadImage(event.source, name, "Script uploaded image", FilenameUtils.getExtension(filepath), "", javaImage.width, javaImage.height, system.file.readFileAsBytes(filepath))
Something like this might do it.