Hi list

I am unable to download a JPG image from an IP Webcam and feed a
PictureBox, without creating a file-like object.

I'm using HttpClient to fetch the images asyncronously, but the buffer
at last is only a string representation of its binary data.

How do I convert this data into an actual image object for viewing in a
PictureBox or DrawingArea?

This is my code so far:


' Gambas class file

PUBLIC $http AS HttpClient
PRIVATE $pic AS String

PUBLIC SUB Form_Open()
  $http = NEW HttpClient AS "MyStream"
  $http.Async = TRUE
  $http.Timeout = 3
  $http.URL = "http://192.168.1.10:4500/axis-cgi/jpg"; &
              "/image.cgi?resolution=320x240"
END

PUBLIC SUB Timer1_Timer()
  $http.Get
END

PUBLIC SUB MyStream_Read()
  DIM buffer AS String
  READ #LAST, buffer, Lof(LAST)
  $pic &= buffer
END

PUBLIC SUB MyStream_Finished()
  ' Here I want to feed the picturebox with the buffered JPG
  ' but $pic only contains a string repr of the binary image
   PictureBox1.Refresh
END

PUBLIC SUB btnStart_Click()
  Timer1.Start
END

PUBLIC SUB btnStop_Click()
  Timer1.Stop
END

PUBLIC SUB btnExit_Click()
  Timer1.Stop
  ME.Close
END

I'd like to avoid using a file, is it possible to do from RAM?

Gambas 2.22
Linux Mint 10 (based on Ubuntu 10.10)
Gnome desktop.

Regards
-- 
Jesus, EA7DFH

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to