Greetings,

My question isn't so much a perl question as a programming/logic question, but since I'm doing it in perl, might as well post it here. I have a .bmp picture file in memory stored as a scalar ($picture) with a size of $picx by $picy. I want to take a subset of this picture starting at $startx,$starty and going through $endx,$endy. The .bmp file foremat can be found here. The most relevant information is at the bottom.

For those of you who don't feel like reading, basically, the picture is stored upside down. Left to right order of each line of the picture is as you would expect, but it starts with the bottom line of the picture first. I need to keep the data of the subset in the right order, so that I can redisplay the smaller picture, and I have been mangling this code every which way with no success.

I know that this can be done with perlmagick, but I'm going to have to be doing this 1-2 times a second, and from what I can tell, PerlMagick has to read the bmp from a file, so I'd have to write the file from memoryto disk, and then read it back into a perlmagick structure before I could do anything.

Thanks for your time!

-John


In reply to BMP file manipulation by Anonymous Monk

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.