Page 1 of 1

[Solved] Moving a sun on a black background to a blue back?

Posted: 2011-08-17T06:33:09-07:00
by owntheweb
Howdy,

Image

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. :D

Best regards,

Chris

Re: Moving a sun on a black background to a blue background?

Posted: 2011-08-17T10:15:42-07:00
by fmw42
see right image for general idea, created with Photoshop for demo purposes
I don't see any right image with any blue background!

Have you tried using a -fuzz XX% with your color replacement?

convert image -fuzz XX% -fill blue -opaque black result

Re: Moving a sun on a black background to a blue background?

Posted: 2011-08-17T11:09:02-07:00
by owntheweb
I got it figured out:

Image
SDO Sun Image Moved From Black to Blue Background by ultrus, on Flickr

Using clutImage() with PHP's Imagick class did wonders. I used a 2D Clut image to change black to dark blue and gradient after that. See this page for more info on how it all works:
http://www.imagemagick.org/Usage/color_mods

It looks better than what I could do in Photoshop! :D

Best regards,

Re: Moving a sun on a black background to a blue background?

Posted: 2011-08-17T11:21:57-07:00
by fmw42
glad you solved it. but both images look like they have a black background (visually), so your dark blue must be very close to black. that was what was confusing to me.

Re: Moving a sun on a black background to a blue background?

Posted: 2011-08-17T11:49:07-07:00
by Bonzo
but both images look like they have a black background
Probaly time to calibrate your monitor :?

Re: Moving a sun on a black background to a blue background?

Posted: 2011-08-17T11:57:11-07:00
by owntheweb
Yeah it's a pretty dark blue (#001427), but do calibrate your monitor. The world of color awaits! :D

Re: Moving a sun on a black background to a blue background?

Posted: 2011-08-17T12:26:40-07:00
by fmw42
owntheweb wrote:Yeah it's a pretty dark blue (#001427), but do calibrate your monitor. The world of color awaits! :D
I recalibrated, but it still looks pretty much black to me (on Mac monitor)

Re: Moving a sun on a black background to a blue background?

Posted: 2011-08-17T20:51:37-07:00
by anthony
You may like to try the global color modification tha was developed for weather maps.
Mathematical Non-linear Histogram Adjustments
http://www.imagemagick.org/Usage/color_mods/#non-linear

This basically adjusts the blue channel to never approach zero, though was designed with gray-scale images in mind.

For your image blue adjustment could be adjusted to only adjust blue channel relative to the overall brightness of the image, so that red and yellow colors do not get a blue component.

RESOLVED: Moving a sun on a black background to a blue back?

Posted: 2012-05-19T07:51:44-07:00
by owntheweb
Sorry to bring this old post back to life. I forgot to share the success of this experiment. A live sun background is now being featured at:

http://www.spacefoundation.org

At the moment I don't recall all the specific details, but the secret sauce was using -clut, combined with some cropping and an alpha mask (better preserving the orange in the center of the sun):
http://www.imagemagick.org/Usage/color_mods/#clut_alpha

Re: [Solved] Moving a sun on a black background to a blue ba

Posted: 2012-05-21T17:08:32-07:00
by anthony
The clut approach applied globally may produce some changes elsewhere on the image.
More details of the CLUT technique would be nice :) , but if you don't remember :roll:

However by using some masking to restrict what areas the clut is applied you can prevent that.

Fred if you can not see the blue, then your monitor must have a a very high 'gamma' setting. I have heard that most Mac Monitors do have a non-standard gamma.

Actually my workstation monitor has a low gamma at the bottom and a higher gamma at the top of the screen! -- And it is a new monitor (I don't get much say about it as the university bought it for me :-( )