parse-wormedit: convert pbm format to monochrome pnm
[wormy.git] / parse-wormedit
index 721cec841e15a519862aae501dd8d7484550ec7c..cf1798d6a25e6cb787b9836577add8782ec93aed 100755 (executable)
@@ -162,6 +162,10 @@ default {
        my $img = Games::Wormy::Render->composite(
                map { $data->{levels}->[$_] } @request
        ) or die "empty result for levels\n";
+       if ($opt{format} ~~ 'pbm') {
+               $img = $img->to_paletted({make_colors => 'mono'});
+               $opt{format} = 'pnm';
+       }
        $img->write(
                $opt{output} ? (file => $opt{output}) : (fh => \*STDOUT),
                type => $opt{format} // 'pnm',