I am helping a theatre redo their website, from a post-Y2K relic to one that promises responsiveness (their phrase). They make a big deal about putting warning flags on images over 1MB, or a certain pixel size (like 800x1340). On the "directions and parking" section the old site had text directions, probably copied from Mapquest in 2002 or so. I kept the narrative and added static maps, since I didn't want to try a "live" google map image, figuring most folks would put the address in the own GPS/map app.
The OSMAND app works great, so I figured I'd do screenshots and show the suggested routes, whether they lined up with the old text or not. They looked good, full screen PNG files with nice colors. Only they ended up way too big for a quick page load.
-rw-rw-rw- 1 user users 1586661 Dec 14 22:19 map_from_westminster.png
Now, I had a 3 color band file, 5 values deep, just like Netscape likes. Applying that to a large image took almost no time:
pnmremap -map=websafe.pam map_from_westminster.pnm >websafe_west.ppm
Note this skips the PNG to PNM and PPM to PNG steps, which I added in a shell script that rotated through the 8 compass points of map/directions I wanted (N, NE, E, etc.)
#!/bin/sh
for img in \
img1 \
img2 \
do
pngtopnm $img.png >$img.pnm
pnmremap -map=websafe.pam $img.pnm | pnmtopng > ${img}_c216.png
done
