Moved image conversion after the verification of the max_value