Follow the conventions for programming PBM tools

man page

Shell script for calling the right pnm filters and for determining the right
values for dithering, scaling and gamma correction.

Write a ghostscript driver.

The program ist not very modular. The optimizing algorithm is very
spezific to the NecP6. There is also some redundant code. -> The NEC
specific parameters should be extracted so that another printer driver
can use the optimazion.

If the picture is too wide it should be printed anyway.