ot;raw&quot;, to put the Bit in LSB &quot;lsb&quot; or to put the Bit in MSB &quot;msb&quot;.</p>

<pre><code> sub bit_plane_array {                       # raw|lsb|msb
   my ($layer,$type) = @_;
   $type = &quot;raw&quot; if not $type;
   my @bit_plane;
   my $mask = 0b00000001;                    # Initialize Mask
   my $act_mask = $mask;
   for( my $w=0; $w&lt;=$#$layer; $w++ ) {      # Iterate Column
     my $col = $layer-&gt;[$w];
     for( my $h=0; $h&lt;=$#$col; $h++ ) {      # Iterate Row
       $ac