Refactored to a shared encoding function.
Pixel output works.
WSGI service added.