Try using system.file.readFileAsBytes
instead of opening the file in Jython, which just gives you a String value.
https://docs.inductiveautomation.com/display/DOC81/system.file.readFileAsBytes
You need to be on a least Ignition 8.1.1 for this to work I think.