Luc Pattyn wrote:
I would not fully trust the string.IndexOf part, since string operations perform unpredictably on non-string data (such as JPEG images, which can contain any bit pattern, that could be misinterpreted as Unicode characters).
You are right, I had a lot of trouble with string.IndexOf when I was trying to isolate just the jpeg by searching for small strings of 2-4 chars. But after a lot of testing using it to find the record delimiter, which is the same 16 byte string in every record, it works very reliably. Even though it is entirely possible for this particular 16 byte string to show up within the jpeg encoding, the odds are against it.
Luc Pattyn wrote:
htres wrote: each record has a fixed 223 byte header That's new info, makes things easier I guess.
Yeah it was a lot easier. That 223 byte header contained the fixed length fields that held the information about the image. I probably should have posted an example of the file format...but it would have been ugly since it is mostly binary.
Luc Pattyn wrote:
htres wrote: wrote it to disk, named it .jpg, and tada, I had the jpeg image As I mentioned earlier if you want the image I guess you can do it without such file using Image.FromStream(); if you need the file, then it is the way to go.
I haven't tried the Image.FromStream option yet, though I plan to eventually. Ultimately I'd like to populate a database with the picture and header data as well. But I'll leave that part for a new thread... ;) Thanks for the help!