Commits

Trammell Hudson committed f72deb0 Draft

Add starting offset option

Comments (0)

Files changed (1)

 my $bit_offset = 0;
 my $px_height = 512;
 my $use_negative;
+my $offset = 0;
 
 GetOptions(
 	"w|width=i"		=> \$cols,
-	"b|offset=i"		=> \$bit_offset,
+	"b|bit-offset=i"	=> \$bit_offset,
+	"o|offset=i"		=> \$offset,
 	"m|msb+"		=> \$use_msb,
 	"s|size=i"		=> \$max_size,
 	"n|negative+"		=> \$use_negative,
 undef $/;
 my $buf = <>;
 
+# Skip offset bytes into the image
+$buf = substr $buf, $offset;
+
 $max_size ||= length $buf;
 $max_size *= 8;
 my @bits = split //, unpack($use_msb ? "b*" : "B*", $buf), $max_size;