Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use Data::Dumper;
- my $bmp_header = join '', map (chr, 0x42,0x4d,0xf6,0xd4,0x04,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x84,0x01,0x00,0x00,0x01,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0xc0,0xd4,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
- opendir (DIR, ".") || die "$!";
- my @files = grep /\.npd$/i, grep !/^\.\.?$/, readdir DIR;
- closedir DIR;
- foreach my $file (@files) {
- my $fn = $file; $fn =~ s/\.npd$/.bmp/i;
- open (fo, ">".$fn) || die "$!";
- binmode fo;
- print fo $bmp_header;
- open (fh, "<".$file) || die "$!";
- binmode fh;
- for(my $i=0; $i<240;$i++) {
- seek fh, -((320*3*2)+($i*320*3)), 2;
- read fh, my $buf, 320*3;
- for(my $c=0;$c<320;$c++) { substr($buf, $c*3+2,1, substr($buf, $c*3, 1, substr($buf, $c*3+2,1))); }
- print fo $buf;
- }
- close fh;
- close fo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement