Results 1 to 11 of 11

Thread: WOW! How do I display a Byte Array in Image Control

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Temecula
    Posts
    36

    Smile

    I am receiving a Byte Array from an internet control - it is a Jpeg. How can I, instead of saving the jpeg to disk and then loading it in the Image control, just directly send the bytes to the image control?
    Thanks
    -Chris

  2. #2

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Temecula
    Posts
    36
    ?

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Two choices:

    1. Make a memory mapped file
    2. Create a StdPicture object and shove the data into it.

    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Temecula
    Posts
    36
    which one is faster, and can you show me the code? thanks
    -Chris

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Either way, the problem is that you end up bypassing the built-in JPEG code. To use that, you pretty much HAVE to use a proper file. Although you can get the data in an image array, pass it to a separate JPEG decoder DLL, then display in the picturebox. A memory-mapped file is the faster of the two, but it's NASTY to pull off.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Temecula
    Posts
    36
    hmm, is there no way to send the image straight to the picture box from memory? (retaining all header info)

    I am downloading this image over the Inet control - ?

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I'm not sure what stage the JPEG data gets decoded at, so I can't say for sure how to get it in there. If it's possible to put JPEG data into a StdPicture, then it could be done that way, but I doubt it. Intel made a very easy-to-use JPEG decoder library, unfortunately it's for C, but I think a VB wrapper has been created for it.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Temecula
    Posts
    36
    I have the Jpeg encoder library - is there anyway to use a memory buffer to store the image? or how about DirectDraw/ BitBlt? I want to have up to 9 simultaneous images chnging.
    -Chris

  9. #9
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    You could always download it to c:\windows\temp then when complete display and delete the file.

  10. #10

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Temecula
    Posts
    36
    Only problem is writing the file to disk every 100 ms gets very time consuming, and cna't handle multiple threads without slowdown

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If this program will only ever be used on your computer, you could set up a RAMDrive, which would stop the 10fps speed problems.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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