Newsgroups: comp.archives Path: utzoo!utgpu!news-server.csri.toronto.edu!ox.com!emv From: raja@bombay.cps.msu.edu (Narayan S. Raja) Subject: [graphics] Re: How do I separate color images into RGB channels. Message-ID: <1991Jan10.213252.23290@ox.com> Followup-To: comp.graphics Keywords: color, RGB Sender: emv@ox.com (Edward Vielmetti) Reply-To: raja@cpswh.cps.msu.edu Organization: PRIP Lab, Comp. Sci. Dept., MSU References: <651@ub.d.umn.edu> <1991Jan10.111006.11356@msuinfo.cl.msu.edu> Date: Thu, 10 Jan 1991 21:32:52 GMT Approved: emv@ox.com (Edward Vielmetti) X-Original-Newsgroups: comp.graphics Archive-name: graphics/pixutils/fbm/1991-01-10 Archive: nl.cs.cmu.edu:/usr/mlm/ftp/fbm.tar.Z [128.2.222.56] Original-posting-by: raja@bombay.cps.msu.edu (Narayan S. Raja) Original-subject: Re: How do I separate color images into RGB channels. Reposted-by: emv@ox.com (Edward Vielmetti) In article <651@ub.d.umn.edu>, (Haseen I. Alam) writes: < I need to get hold of some programs that will run in SunTools, and will < allow me to separate a color image into its RGB channels and display them < separately. It will be nice if it will recombine them again. Get Michael Mauldin's "FBM" set of utilities: available by anonymous ftp from the "/usr/mlm/ftp" subdirectory on nl.cs.cmu.edu (128.2.222.56). (You can only cd straight to that directory). The FBM utilities are independent of your windowing environment. I assume you want to work with 8-bit colour Sunraster files. ------------------------------------------------------ Going from 8-bit colour to the 3 colour planes is easy: cat image.ras | clr2gray -S -r1 > image.red.ras cat image.ras | clr2gray -S -g1 > image.grn.ras cat image.ras | clr2gray -S -b1 > image.blu.ras (The 3 colour planes are themselves extracted as Sun grayscale rasterfiles). Going from 3 colour planes back to an 8-bit colour image is somewhat painful (anyone know a better way?): 1. remember the number of rows and columns 2. strip off the header by some means, leaving 3 "raw" images (just the bytes, no header) 3. concatenate these raw files in the order r,g,b: cat image.red.raw image.grn.raw image.blu.raw > image.raw 4. convert to fbm format: raw2fbm -d3 -hrows -wcols < image.raw > image.fbm where rows=no. of rows, cols=no. of columns 5. quantize to 8 bits: fbquant -S < image.fbm > image.8-bit-ras ------------------------------------------------------ Narayan Sriranga Raja.