24 lines
442 B
Python
24 lines
442 B
Python
#
|
|
#
|
|
#
|
|
from PIL import Image
|
|
|
|
|
|
class JpgTools:
|
|
|
|
def __init__(self):
|
|
pass
|
|
#
|
|
def process(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(self, fname):
|
|
img_h = Image.open(fname)
|
|
img_bin = list(img_h.getdata())
|
|
return img_bin
|