Performance and command line update

I added automatic image resize so that it can run on really large images in a timely manner. I also fixed up the command line version so it uses argparse and has some prettier output.
What `main()` did was moved down to under `if __name__ == "__main__":` which was calling `main()` anyway. This was needed for multiprocessing support.