There are stark differences between the scenarios you’re presenting, but going to the core of your point, is it even legal to paint a photorealistic nude?
I don’t know of any court cases about this specific subject, but I remember when Rush painted Tiger Woods (“The masters at Augusta”), he was sued.
He got away with not having to pay money to Tiger Woods, but partly because it’s a stylized painting and it pushed towards first amendment rights. This wouldn’t work in a photorealistic depiction, so it seems highly unlikely that such a painting would be OK…