# # # import logging from PIL import Image from libs.jpg_bin import JpgBin class JpgTools: def __init__(self): self.fh = None pass # # process a jpg file, read only # def getJpgBin(self, fname): return self.processFile(fname) # # process a jpg file, create new jpg with crypto keys # def jpgHash(self): self.fh = open(fname, "rb") self.jpg = JpgBin() retval = self.jpg.processFile(self.fh) logging.info("processFile()=={}".format(retval)) # def processFile(self, fname): self.fh = open(fname, "rb") self.jpg = JpgBin() retval = self.jpg.processFile(self.fh) logging.info("processFile()=={}".format(retval)) return self.jpg # def process_OLD(self, fname): Image.open(fname) # image as a sequence object containing pixel values bin_data = list( im.getdata() ) # returns a string containing pixel data, using the standard "raw" encoder im.tostring() # # def getJpgBin_OLD(self, fname): # img_h = Image.open(fname) # img_h.???