Hi all

I've been asked to write something to pull jpg/jfif files out of a binary file. I've had some limited success with my hex editor and I want to try it in perl. From my reading the picture stream starts withs 0xFFD8 and ends with 0xFFD9. The idea is that if I can pull everything out from between these markers we should have a valid jpeg image. I also suspect there are multiple jpegs within the binary file and they also each contain a thumbnail.

So my first question is can anyone point me in the right direction for extracting a block out of a binary file between 2 markers ? Once I get this working I think it should be quite straight forward.

Thanks in advance

wert


In reply to extract jpg from binary file by wertert

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.