We need to check if image's extension is ".jpeg" and threat it as ".jpg". That's why we check if image's extension is in ['.jpeg', '.jpg'] and desired extension is in ['.jpeg', '.jpg'] too - we don't need conversion then.