very close, after a couple minor mods, I am getting TypeError: uploadImage(): expected 9 args; got 8
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
gi = DTGatewayInterface
filepath = system.file.openFile()
if filepath is not None:
name = File(filepath).name
# javaImage = Toolkit.defaultToolkit.getImage(filepath)
javaImage = Toolkit.getDefaultToolkit().getImage(filepath)
gi.uploadImage(event.source, name, "Script uploaded image", FilenameUtils.getExtension(filepath), "", javaImage.width, javaImage.height, system.file.readFileAsBytes(filepath))