From: Mischa POSLAWSKY Date: Fri, 14 Feb 2020 23:05:02 +0000 (+0100) Subject: distinguish (mostly) transparent pixels X-Git-Url: http://git.shiar.nl/minime.git/commitdiff_plain/cc9790a26905cae34eda0d55fcf77d60e8fdc42c distinguish (mostly) transparent pixels --- diff --git a/termimg b/termimg index 24f6a33..3dd0fa4 100755 --- a/termimg +++ b/termimg @@ -61,6 +61,8 @@ open my $pgm, '-|', convert => ( -thumbnail => $size || '40x12', -colorspace => 'gray', '-normalize', + -level => '-1%', + -channel => 'A', -threshold => '50%', -background => 'black', -layers => 'flatten', -compress => 'none', @@ -72,7 +74,7 @@ if (<$pgm> eq "P2\n") { <$pgm>; # ignore depth my @ch = split //, " .:oO@"; while (<$pgm>) { - print $ch[ $_ * @ch >> 8 ] for /\d+/g; + print !$_ ? '/' : $ch[ $_ * @ch >> 8 ] for /\d+/g; print ' ', shift @info if @info; print $/; }