Refactor convertImage to use an object for the conversion options. Add documentation.