Optimizations

Added set_constrast, set_dimensions and invert functions. Removed
dimensions arguments from object constructor.