Signature component image to Report

I am trying to use the image produced from the signature component in a report. the signature component creates a base64 string. Can this be used directly by the key in the report image?

No, not directly (although if you wait a few weeks, 8.0.14 will give you direct access to the byte array of the image).

What you need to do is strip the preamble off the data URL, then deserialize the base64-encoded bytes of the actual image:

    from com.inductiveautomation.ignition.common import Base64
    data = Base64.decode(event.signature.split(',')[1])
    system.db.runNamedQuery("insertImage", {'name': 'signature.png', 'bytes': data}

thanks for help PGriffith.

I wasn’t able to get it to work with the named query as it gave an error ‘did not return a result set’

but I did managed to get it to work by changing the insert into the script instead.

from com.inductiveautomation.ignition.common import Base64
data = Base64.decode(event.signature.split(',')[1])
system.db.runPrepUpdate("INSERT into table (name, bytes) VALUES (?,?)", ['signature123.png', data])
1 Like

How did you read this back out to the report ?