implement changing maxWidth and maxHeight in Image class