If you added something to the painting then you're selling a derivative work, and if you didn't then you're selling a copy of the work itself - but either way an expressive work is being used, which is what copyright law regulates. IANAL, but with LLM models and outputs that seems not to be the case.