Compose an RBG image from 3 grayscale images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Compose an RBG image from 3 grayscale images

Post by rmagick »

Question from an RMagick user: "I have 3 grayscale images, each representing one color channel of an image (RGB). I want to recompose the colored image."

How would I do this using the utility commands?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Compose an RBG image from 3 grayscale images

Post by el_supremo »

This combines the gray scale images into one rgb image:

Code: Select all

convert image_r.jpg image_g.jpg image_b.jpg -combine image_combo.jpg
Pete
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: Compose an RBG image from 3 grayscale images

Post by rmagick »

Thanks! Of course CombineImages is one of the few APIs that RMagick doesn't support. I figured out another way though, using 3 composite operations. Now I'm off to add support for CombineImages...
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Compose an RBG image from 3 grayscale images

Post by anthony »

It was a late addition when IM v6 was release in response to a users problem, so I am not suprised you missed it.

You probably should check -separate too as it when from one channel only to multiple channles (as multiple images).

Both use channels to determine which channels are being separated or combined.
You can for example miss the 'blue' channel bu using -channel RGA but order
is always RGBA as channel only sets flags, it does not remember order.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: Compose an RBG image from 3 grayscale images

Post by rmagick »

Thanks, Anthony. I'll check it out. I added CombineImages yesterday.
Post Reply