title: How to convert image to bytearray?
body: <p>I want create a video steaming on socket, but I can't convert an image to bytearray.
  why i can't convert image form camera to  bytearray?</p>
  
  <pre class="lang-py prettyprint-override"><code>CHUNK=1024 lnF = 640*480*3    
  wvs = WebcamVideoStream(0).start()    
  while True: for x in range(1):
          try:
              frame = wvs.read()
              cv2_im = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
              # cv2.imshow('frame',cv2_im)
              # if cv2.waitKey(1) &amp; 0xFF == ord('q'):
              #     break
              frame = cv2.resize(frame, (640, 480))
              # print("frame :", frame)
              frame = np.array(frame, dtype = np.uint8).reshape(1, lnF)
              # print("frame :",frame)
              jpg = bytearray(frame)
              # print("jpg_as_text", jpg_as_text)
              # print("ACCEP")
          except Exception as e:
              print(e)
  </code></pre>