Thank you Detlev, That helped.

This is what I've done, for future reference if anybody else has the
same question...

//grabbing the frame from webcam source where fgc is a
FrameGrabbingControl object.
Buffer buf = fgc.grabFrame();
BufferToImage btoi = new BufferToImage((VideoFormat) buf.getFormat());
Image photo = btoi.createImage(buf);

//Converting Image object to InputStream object
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write((RenderedImage) photo, "jpg", out);
byte[] imgData = out.toByteArray();
InputStream bigInputStream = new ByteArrayInputStream(imgData);

//using myMedia in the insert() function to upload to picasa service
MediaStreamSource myMedia = new MediaStreamSource(bigInputStream,
"image/png");

If there is any "better" way to do this, please let me know.

P.S: I'm able to grab a frame, upload to picasa web albums, and repeat
this 10 times roughly at an average of 0.8 secs per iteration. Can I
perform better?

Thank you.

On Jan 19, 11:23 am, Detlev Schwabe <[email protected]> wrote:
> Check out com.google.gdata.data.media.MediaStreamSource. That gives
> you the option to use any InputStream for the media.
>
> On Jan 18, 12:03 am, Anurag Simgeker <[email protected]> wrote:
>
>
>
> > Hello all,
> > I'm using JMF to initialize a webcam source, grab a frame, save it as
> > a JPEG and upload to Picasa Web Albums.
>
> > I'm using the following code to grab a frame from a webcam player:
>
> > FrameGrabbingControl fgc = (FrameGrabbingControl)
> > myWebcamPlayer.getControl
> > ( "javax.media.control.FrameGrabbingControl" );
> > Buffer buf = fgc.grabFrame();
>
> > Then i go about saving that Buffer buf as a JPEG image.
>
> > My question is: Is there anyway to take that Buffer buf, and use that
> > as a MediaSource or MediaFileSource instead of saving it as a file
> > first?
>
> > The documentation says: "....you can instead use MediaSource to use an
> > image from another kind of data stream."
> > But I just cannot find any further information on that.
>
> > I'd really appreciate if anyone can point me in the right direction...
>
> > Thanks in advance
-- 
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-picasa-data-api?hl=en.


Reply via email to