Dear Tachyon
Thank you for your very helpful example. I am trying to adapt it my own needs and I am struggling with parts 4 and 5 in your example.
I am working with images that are 1024 high x 1280 wide using 8 bit grey scale to represent each color. So for instance I have used the following to get the color table:
<c>
my @rgbQuad = wq (
rgbBlue
rgbGreen
rgbRed
rgbReserved
);
my @rgb_dat = unpack "LLLL", $data;
my %rgbQuadList;
@rgbQuadList{@rgbQuad} = @rgb_dat;
print "$_\t$rgbQuad{$_}\n" for @rgbQuad;
<\c>
to retrieve the rgb color table data. This returns one line of data for the Blue, Green, Red and Reserved colors. What I am not understanding is how to get every instance of this color table by reiterating through $data. I have also tried assigning < BMP > to an array but that does not seem to behave like the standard file handles I am more typically used to.
Secondly I don't understand how to extract the data lines for the image. So my offset is 1078 bits. According to your calculation, and using an 8 bit pixel assignment, I need to capture 10242 bytes per line for my bit maps. How do I set this for unpack?
Thank you for taking the time to answer my questions.
MadraghRua yet another biologist hacking perl....
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|