How to combine individual R,G,B channels into 16bit output?
Author: mwilmesCreated Aug 5, 2021Updated Jul 12, 2026
Labelsquestion
What are you trying to achieve?
Selectively extracting single R,G and B channels from three different 16bit input tiff files. Then combining them to a new 16bit output tiff. With srgb output color space (8bit) everything works as expected. As I switch to rgb16 colourspace for output I get a pure black image.
Have you searched for similar questions?
Yes but nothing yet seems to point me on what I'm doing wrong.
Are you able to provide a minimal, standalone code sample that demonstrates this question?
Promise.all([
sharp('input1.tif')
.extractChannel('red')
.toColourspace('b-w')
.toBuffer(),
sharp('input2.tif')
.extractChannel('green')
.toColourspace('b-w')
.toBuffer(),
sharp('input3.tif')
.extractChannel('blue')
.toColourspace('b-w')
.toBuffer()
])
.then(images => {
sharp(images[0])
.joinChannel([
images[1],
images[2]
])
//.toColorspace('srgb')
.toColorspace('rgb16')
.tiff({
compression: 'none'
})
.toFile('output.tif');
});Output file:

Are you able to provide a sample image that helps explain the question?
Too large of files.
Source: lovell/sharp