Hello,
being new to imagemagick I have a most likely simple question:
I have three 16bit-TIF Images, corresponding to the R, G and B channel of a color image. How do I combine these into a single one-page 48bit-TIF color image?
Many thanks in advance for any hints.
Hermann-Josef
Combining TIFs to 48bit RGB-TIF
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Combining TIFs to 48bit RGB-TIF
I don't know what you mean by 16-bit and 48-bit, but how about:
Code: Select all
convert a.tif b.tif c.tif +append out.tif
snibgo's IM pages: im.snibgo.com
Re: Combining TIFs to 48bit RGB-TIF
Hi,
thanks for your reply. Perhaps I should give some more details.
I have an image being the raw data from a slide scanner. The raw image consists of pixels, each of which is a 16bit number for the R, G, B and IR channel. I have used imageJ to extract from this raw image 4 separate images as 16bit (single color) TIF-files corresponding to the 4 channels. Now I want to combine three of them, corresponding to R,G and B into a single TIF-File (not a multi-page TIF) which is then an RGB-image with 48bit / pixel, 16bit for each color).
You can phrase it differently: I want to eliminate the fourth channel (IR) from the raw data file (TIF), so each pixel is just R,G and B with 16bits/pixel/color (and not R,G,B,IR).
I have tried various things. I can do this with imageJ ("image -- color -- stack to RGB" in imageJ) but this produces 24bits/pixel TIFs, not 48bit TIFs. I have tried imagemagick but without success thus far.
Hermann-Josef
thanks for your reply. Perhaps I should give some more details.
I have an image being the raw data from a slide scanner. The raw image consists of pixels, each of which is a 16bit number for the R, G, B and IR channel. I have used imageJ to extract from this raw image 4 separate images as 16bit (single color) TIF-files corresponding to the 4 channels. Now I want to combine three of them, corresponding to R,G and B into a single TIF-File (not a multi-page TIF) which is then an RGB-image with 48bit / pixel, 16bit for each color).
You can phrase it differently: I want to eliminate the fourth channel (IR) from the raw data file (TIF), so each pixel is just R,G and B with 16bits/pixel/color (and not R,G,B,IR).
I have tried various things. I can do this with imageJ ("image -- color -- stack to RGB" in imageJ) but this produces 24bits/pixel TIFs, not 48bit TIFs. I have tried imagemagick but without success thus far.
Hermann-Josef
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Combining TIFs to 48bit RGB-TIF
Ah, okay. You have 3 input files. Each is grayscale, but represents one of R, G and B.
The answer is in your title: use "-combine". See http://www.imagemagick.org/script/comma ... hp#combine
If that doesn't work, then posting sample images would help. Put them somewhere like dropbox.com and paste the links here.
The answer is in your title: use "-combine". See http://www.imagemagick.org/script/comma ... hp#combine
Code: Select all
convert a.tif b.tif c.tif -combine out.tif
snibgo's IM pages: im.snibgo.com
Re: Combining TIFs to 48bit RGB-TIF
Great, that worked perfectly!
As I mentioned, I used imageJ to get the grayscale Images, to begin with. In the end I would, of course, like to do this in one go over many files in imagemagick.
So the first question would be, if it is possible to convert the 4x16bit/pixel TIF image into a 3x16bit/pixel image, which would be the RGB image, in imagemagick directly.
If the answer is "YES", then the second question is, how to do this in batch mode, say for all TIF-files in a folder named image_001.tif, image_002.tif, and so on, resulting in the RGB-TIFs image_001_RGB.tif, image_0002_RGB.tif etc.
Many thanks for your help!
Hermann-Josef
As I mentioned, I used imageJ to get the grayscale Images, to begin with. In the end I would, of course, like to do this in one go over many files in imagemagick.
So the first question would be, if it is possible to convert the 4x16bit/pixel TIF image into a 3x16bit/pixel image, which would be the RGB image, in imagemagick directly.
If the answer is "YES", then the second question is, how to do this in batch mode, say for all TIF-files in a folder named image_001.tif, image_002.tif, and so on, resulting in the RGB-TIFs image_001_RGB.tif, image_0002_RGB.tif etc.
Many thanks for your help!
Hermann-Josef
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Combining TIFs to 48bit RGB-TIF
I don't know if IM can read your 4x16bit/pixel TIF files. With luck, it can, treating the 4th channel as alpha. You can then ignore the alpha.
Code: Select all
convert in.tif -alpha off out.tif
snibgo's IM pages: im.snibgo.com
Re: Combining TIFs to 48bit RGB-TIF
Thanks a lot for your reply.
Unfortunately the trick with the alpha channel did not work. So I will set up a macro for imageJ and split the pixels there.
If I have then a series of images in a folder, with the RGB channels named image_001_R.tif, image_001_G.tif, image_001_B.tif, image_002_R.tif etc. and I want to run a macro to create the RGB Images, how would the macro look like to create the output files image_001_RGB.tif, image_002_RGB.tif etc.?
Best wishes
Hermann-Josef
Unfortunately the trick with the alpha channel did not work. So I will set up a macro for imageJ and split the pixels there.
If I have then a series of images in a folder, with the RGB channels named image_001_R.tif, image_001_G.tif, image_001_B.tif, image_002_R.tif etc. and I want to run a macro to create the RGB Images, how would the macro look like to create the output files image_001_RGB.tif, image_002_RGB.tif etc.?
Best wishes
Hermann-Josef
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Combining TIFs to 48bit RGB-TIF
You would write a script. See tutorials or references for the script language of your choice.Jossie wrote:If I have then a series of images in a folder, ...
snibgo's IM pages: im.snibgo.com