Page 1 of 1

### Is this possible? (colour + detail = colour&detail)

Posted: 2019-08-29T04:46:36-07:00
I basically want to influence the hue of every pixel in one image by using another image as source information. Black and white wouldn't (can't) change, but the colourisation of all grey pixels would match that of another input to give a desired output, like in this example:-

The only way I can imagine myself doing this is to process the middle greyscale image to isolate the highest and lowest ranges, making 2 alphas, and then brightening/darkening the first coloured image so it resembles the final outcome on the right, which might just be another way of saying what I want to do, but I don't think it would be accurate for all use-cases since I won't know how much to adjust each image. It's the best idea I can achieve with my current skills.

So, any advice is greatly appreciated.

### Re: Is this possible? (colour + detail = colour&detail)

Posted: 2019-08-29T05:35:24-07:00
Do you want to take an image then break it down into two images? Or do you have two input images and need to combine them?

Your middle image seems to be the lightness of the right-hand image. I'm not sure what you have or want in the left-hand image.

Colour images usually have three channels. We can separate them to put two channels in one image and the third channel in a separate image. For example, in L*a*b* space, we can record the a* and b* in one image, and L* in another.

### Re: Is this possible? (colour + detail = colour&detail)

Posted: 2019-08-29T06:08:39-07:00
I'd like to take the colour information from every pixel of the first image to colourise/hue-shift every pixel in the second image to get an outcome such as the third image. Where black and white wouldn't change because it's being colourised by gray, but the sky becomes blue and the shorts become red with yellow dots.

Is that possible in any way?

### Re: Is this possible? (colour + detail = colour&detail)

Posted: 2019-08-29T06:44:10-07:00
I think you want to make every gray pixel in the first image transparent, then composite that over the second image.

If you supply the three actual images, we can check that. They should be PNG sources or similar that have not been through JPEG compression.

### Re: Is this possible? (colour + detail = colour&detail)

Posted: 2019-08-29T15:34:18-07:00
Your idea sounds okay but there's a huge caveat - what if the image with the colour is lower resolution than what I want to composite over? I'd like to keep the clarity of the greyscale details but colourise it as much as I can from another image. I was thinking about what you said about splitting all of the colour channels, cleaning those up by filtering each one with the others (to remove all greys too) and then using those as masks to colourise.

Here are the source images:-
http://www.violae.net/temp/IM_colplusgreycom.zip

### Re: Is this possible? (colour + detail = colour&detail)

Posted: 2019-08-29T16:48:37-07:00
I make a mask that is white where ele_a has any colour, and black where ele_a is a shade of gray. Then I composite with that mask.

Code: Select all

``````%IMG7%magick ^
ele_a.png ^
-colorspace HSL -channel 1 -separate +channel ^
-threshold 0 ^

%IMG7%magick ^
ele_b.png ^
ele_a.png ^