bitmap.py: Rewrite for better clarity and to properly support img files

* Output file may now *optionally* be a .h or .img
* Added sanity check for when input == output
* Possibly fixed error in dataSize field of comressed output files: Previous value of dataSize was 2x reality