I want to return two pictures in Byte to my vue
But they can't use in the json, so how I can return these two in one time?
Here is my code!
file1 = Image.open(files[0])
file1.save('1.jpg')
with open('1.jpg', 'rb') as f:
a = f.read()
img_stream1 = io.BytesIO(a)
img1 = Image.open(img_stream1)
imgByteArr1 = io.BytesIO()
img1.save(imgByteArr1, format='JPEG')
imgByteArr1 = imgByteArr1.getvalue()
print(imgByteArr1)
file2 = Image.open(files[1])
file2.save('2.jpg')
with open('2.jpg', 'rb') as g:
b = g.read()
img_stream2 = io.BytesIO(b)
img2 = Image.open(img_stream2)
imgByteArr2 = io.BytesIO()
img2.save(imgByteArr2, format='JPEG')
imgByteArr2 = imgByteArr2.getvalue()
print(imgByteArr2)