Implemented the majority of image functions.