Page 1 of 1

Recreate third color channel with 2 channels and grayscale image.

Posted: 2017-12-16T09:35:19-07:00
by coolperez8
Let's say I have a grayscale version of the image, and 2 of the color channels. Assuming that the fx command below was used to generate the grayscale, how can I recreate the third channel and piece the channels together in one command?

Code: Select all

-fx '(r+g+b)/3'

Re: Recreate third color channel with 2 channels and grayscale image.

Posted: 2017-12-16T10:11:43-07:00
by snibgo
You need to know which channel is missing, so they can be combined in the correct order. I'll assume it is the blue channel.

First, find an expression for the missing channel. Fairly obviously:

blue = 3*gray - red - green

The IM operation that can make one image from many inputs, each with a known weight, is "-poly".