#!/usr/bin/perl # Pilot bitmap extraction tool 1.0, March 1997 by Ka-Ping Yee # # On stdin accepts a Pilot bitmap resource. Writes a text file to stdout # describing the bitmap: the first line contains four numbers (width, height, # bytes per row, and flags), then the next lines contain characters # representing the pixels (dot for an empty pixel, x for a filled pixel). $data = join('', <>); ($wid, $hgt, $bpr, $flags) = unpack('nnnC', $data); print "$wid $hgt $bpr $flags\n"; $pixels = substr($data, 16); for $y (0..$hgt-1) { $row = unpack('B*', substr($pixels, $bpr * $y, $bpr)); $row =~ tr/01/.x/; print substr($row, 0, $wid) . "\n"; }