
I have a live image of the sun from SDO (original on left) that I want to incorporate into a design dynamically. In order to do this I need to replace the black background with a blue one (see right image for general idea, created with Photoshop for demo purposes).
If I do a simple color replace of black to blue, I get the middle image as a result naturally. This is rather rigid and ugly though, so I need something that will deal with multiple shades and keep as much of the orange/blue combo looking nice as possible.
I was going to write something for use in GD, but ImageMagick has a lot of functions that may handle this more elegantly? What are your thoughts on getting started?
Thanks for the feedback in advance.

Best regards,
Chris