From: Mischa Poslawsky Date: Mon, 26 Oct 2020 21:32:42 +0000 (+0100) Subject: parse-wormedit: convert pbm format to monochrome pnm X-Git-Url: http://git.shiar.nl/wormy.git/commitdiff_plain/2ee2aec7f8c45810467927786d968afd51b38c38?ds=sidebyside parse-wormedit: convert pbm format to monochrome pnm Imager determines pnm subtype only by number of channels, so reduce the palette to obtain a P4 format as requested. --- diff --git a/parse-wormedit b/parse-wormedit index 721cec8..cf1798d 100755 --- a/parse-wormedit +++ b/parse-wormedit @@ -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',