Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
Can I return two ByteArray in flask?

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)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!