blob: 4f0dc33ce5d0852a0b47fa0f43c151f69e079a6c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env perl
use strict;
use warnings;
use Games::NES::SpriteMaker 'image_to_sprite';
my $data;
if (@ARGV) {
$data = $ARGV[0];
}
else {
$data = \(do { local $/; <> });
}
my $sprite_data = image_to_sprite($data);
if (@ARGV) {
(my $outfile = $data) =~ s/\..*$/.chr/;
open my $fh, '>', $outfile
or die "Couldn't open $outfile for writing: $!";
$fh->print($sprite_data);
$fh->close;
}
else {
print $sprite_data;
}
|