TMZ has learned ... Gary Coleman's ex-wife is the mastermind behind the photos which show the actor in the hospital, bloodied, with tubes sticking out of his body ... and there's also a photo taken after he died.

We're told Shannon Price had a production company shoot the photos.

Our sources say Shannon is featured in one of the photos.