Results 1 to 4 of 4

Thread: Working with JPEG raw data in memory

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    160

    Working with JPEG raw data in memory

    I'm receiving some raw JPEG data that is sent from a camera through a socket, along with a custom header where it specifies things like width, height, bright, device, colours, etc.

    Could someone give me some tips regarding how I should handle this? Thanks in advance.

  2. #2
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Working with JPEG raw data in memory

    You mean your receiving a byte array containing a JPEG with an additional custom header? Or is the custom header integrated within the JPEG header?

    The JPEG will most likely be a JFIF (JPEG File Interchange Format) I think this is the format JPEGs are predominantly stored as. If you want to display the passed image, off the top of my head, the easiest way would be to write it to disk and then load it into a control. Otherwise you will have to decode the image yourself onto something like a DIB Section structure. If the custom header is not integrated into the JFIF you will have to separate them, I assume the custom header is either a fixed size or declares it's length.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    160

    Re: Working with JPEG raw data in memory

    Quote Originally Posted by Milk
    You mean your receiving a byte array containing a JPEG with an additional custom header? Or is the custom header integrated within the JPEG header?

    The JPEG will most likely be a JFIF (JPEG File Interchange Format) I think this is the format JPEGs are predominantly stored as. If you want to display the passed image, off the top of my head, the easiest way would be to write it to disk and then load it into a control. Otherwise you will have to decode the image yourself onto something like a DIB Section structure. If the custom header is not integrated into the JFIF you will have to separate them, I assume the custom header is either a fixed size or declares it's length.
    I don't have any further details yet, I only know the header structure so far, but I think the header is integrated within the JPEG header.

    Do you have any details on that DIB Section?.

  4. #4
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Working with JPEG raw data in memory

    It would be much easier to write the data to disk temporarily and load it into a control, you don't have to decode it that way and it could be done with only a few lines of code.

    If you really don't want to write the file to disk I guess a DIBSection structure would be what you could use to dump the decoded bytes onto. You will still have to decode the jpeg image, this could be coded but there might also be a free dll out there somewhere that can do this for you.

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