Major refactorization

- Moved global code to __main__ method
- merged rgb versions of functions into one
- img.show() is commented out because of Vista/win7 bug in PIL
--> saves to output.jpg instead