Photopea is a free powerful online tool that can edit photos, available at https://www.photopea.com/
There are also paid models that can be used, it can be hosted locally on a server in case there is that need (I did not explore on how to do that), details on licensing are on the below link:
https://www.photopea.com/api/accounts#distributors
More details on the API here:
https://www.photopea.com/api/
To use, check the demo, the save button will call an API that saves the image on the server side
The inputs available on the structure are not fully working yet, I am still working on them.