This check and the raised error should be moved to utility function (e.g. `_validate_image`) and reused for the 3 new functions.