Bitmap/Histogram: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: bleh. e before h) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: use correct file extension for portable bitmap) |
||
Line 966: | Line 966: | ||
my @gray = grayscale($bmp); |
my @gray = grayscale($bmp); |
||
my $threshold = @gray.sum / @gray; |
my $threshold = @gray.sum / @gray; |
||
for @gray.rotor($bmp.width) |
for @gray.rotor($bmp.width) { |
||
my @row = $_.list; |
my @row = $_.list; |
||
@row.push(0) while @row % 8; |
@row.push(0) while @row % 8; |
||
Line 979: | Line 979: | ||
histogram($b); |
histogram($b); |
||
'./Lenna-bw. |
'./Lenna-bw.pbm'.IO.open(:bin, :w).write: $b.P4;</lang> |
||
See [https://github.com/thundergnat/rc/blob/master/img/Lenna.png Lenna], and [https://github.com/thundergnat/rc/blob/master/img/Lenna-bw.png Lenna-bw] images. (converted to .png as .ppm format is not widely supported). |
See [https://github.com/thundergnat/rc/blob/master/img/Lenna.png Lenna], and [https://github.com/thundergnat/rc/blob/master/img/Lenna-bw.png Lenna-bw] images. (converted to .png as .ppm format is not widely supported). |