Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3602
| From | "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: 4-byte greyscale imag |
| Message-ID | <g23jb0$pmb$1@registered.motzarella.org> (permalink) |
| Newsgroups | comp.lang.java.gui |
| Date | 2011-04-27 15:45 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui On 2008-06-03 16:02 +0100, Paul.Lee.1971@gmail.com allegedly wrote: > Hi everyone, > Hopefully someone can help me, this is really "bugging me" ! > > I have a RGB image, and I'm trying to get the Y Luminance component to > display and manipulate. I think I've done something that goes someway > to solving this: > > BufferedImage greyImage=new > BufferedImage(img.getWidth(),img.getHeight(),BufferedImage.TYPE_BYTE_GRAY); > greyImage.getGraphics().drawImage(img,0,0,null); > > The problem now is that the image is an 8 bit grayscale image. What > I'd like to be able to do is draw colours transparently on top of the > grey image; in effect "colouring in" the image but leaving the details > of the background untouched. For that I think I'd need RGB and alpha > values; how can I covert the 8 bit grayscale to 32 bit/1 int > grayscale? Make the three lower bytes of your int the same value as your byte (8 bit int). The topmost byte defines alpha (0x0->transparent; 0xff->opaque). -- DF. to reply privately, change the top-level domain in the FROM address from "invalid" to "net" --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Next in thread | Find similar | Unroll thread
Re: 4-byte greyscale imag "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000 Re: 4-byte greyscale imag Paul.Lee.1971@gmail.com.remove-dii-this - 2011-04-27 15:45 +0000
csiph-web