CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2002
    Posts
    3

    How can I show a JPG image from memory?

    I have made an ActiveX that communicates with a web camera. When the ActiveX has received an image from the camera (in jpg format) an event is sent to the VB program that uses the ActiveX. How can I show the jpg from the buffer in the ActiveX in the VB program (picturebox or image)? I do not want to save the image to disk and use the LoadPicture function in VB since the camera is streaming pictures all the time.


  2. #2
    Join Date
    Jan 2002
    Posts
    3

    Re: How can I show a JPG image from memory?

    I made a method in my ActiveX that returned a IPicture* to the VB program and then set the Picture property of a Form to the returned pointer. This works fine but the image quality is not very good. Why?
    To try this I let the ActiveX save the picture to disk (jpg file) and then create the IPicture pointer from the same data. Double clicking on the saved JPG file shows an image of the correct quality but if I load the same jpg file to the Picture property of the Form (using LoadPicture function) shows the image with less quality. Why not the same file show in different quality when showing it on the Form?


  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: How can I show a JPG image from memory?

    Vb forms work at 256 colours.

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: How can I show a JPG image from memory?

    Could you elaborate it please? I didn't quite get it.


  5. #5
    Join Date
    Jan 2003
    Location
    Bulgaria
    Posts
    75

    Numinel would you post the code

    Hi,
    the code you writen (that creates a IPicture from JPG file) is just that i'm looking for. Would you post it here please?

    Also it will be interesting if it works with other formats (like GIF for exam).

    Thanks a lot
    .:: ::.

  6. #6
    Join Date
    Jan 2002
    Posts
    3
    Quite some time since I worked with this...

    Well...the activex I made is not just a simple code snippet. It consists of ~40-50 files written in pure C++ (i.e. no MFC or ATL).

    So if you're not familiar with COM/ActiveX programming in C++ there is no point posting the source here. Sure I could send you the source but I don't have time answering questions about it.

  7. #7
    Join Date
    Mar 2002
    Posts
    19

    HELLO FRIEND

    I am also aiming to work on video conferencing
    so u r activex is of my use
    if it then plz .. can u help me
    by sharing it
    if u want to any help from me..
    i am always ready to help u
    Thanx
    my mail id is Atul_tak@rediffmail.com/hotmail.com

  8. #8
    Join Date
    Jan 2003
    Location
    Bulgaria
    Posts
    75

    Thank you

    Thank you. Just a minute ago i found what i've searched for.

    Check it here:

    http://www.codeguru.com/forum/newrep...threadid=27020

    The cksiow code creates IPicture from array of bytes or from string variable. He uses OLELoadPicture and does what LoadPicture does except that the parameter isn't a filename but array.
    .:: ::.

  9. #9
    Join Date
    Jan 2003
    Location
    Bulgaria
    Posts
    75

    Ooops

    .:: ::.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured