Made the grid feature modular.

Can now be used as a library so any PIL image can be gridded.