Hi Thiago,
Are you using On-Premise infra or the Cloud PaaS? On PaaS, you have limited control over the infrastructure.
SetStatusCode mentions, Setting custom HTTP status codes is an advanced extensibility scenario, so be sure to test if it works as intended in your specific infrastructure.
However, if you are sending this image as a response to REST API call then it is fairly easy. Refer Change the HTTP Status Code of a REST API
Regards,
Swatantra