Each non-whitespace character in txt becomes a dark pixel in img. Line feeds are interpreted as vertical translation, tabs and spaces as horizontal translation.
All ASCII characters receive a unique pixel alpha (higher order characters cap out at opaque black), so the resulting image could be mapped back to the original text without too much trouble.