Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #126

Re: How to do image-type

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "hiwa" <hiwa@THRWHITE.remove-dii-this>
Subject Re: How to do image-type
Message-ID <1163763334.110753.116650@b28g2000cwb.googlegroups.com> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <1163755756.272634.317060@m7g2000cwm.googlegroups.com><e
References <1163755756.272634.317060@m7g2000cwm.googlegroups.com><e
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 40
Date Wed, 27 Apr 2011 15:25:45 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303917945 96.60.20.240 (Wed, 27 Apr 2011 10:25:45 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:25:45 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:126

Show key headers only | View raw


  To: comp.lang.java.gui
Thomas Weidenfeller wrote:
> hiwa wrote:
> > I'd like to convert a standard TYPE_INT_ARGB BufferedImage to a
> > TYPE_BYTE_BINARY one. Getting simple black and white ARGB image from
> > original image was a piece of cake. However, I have no clue from there
> > on.
>
> You did not tell us what you want to achieve. So the following should
> give you what you asked for, but it might not be what you really want:
>
> 	BufferedImage argb = ...
>
> 	BufferedImage bb = new BufferedImage(
> 				argb.getWidth(),
> 				argb.getHeight(),
> 				TYPE_BYTE_BINARY);
> 	Graphics2D g = bb.createGraphics();
> 	bb.drawImage(argb, 0, 0, null);
>
> Note: Not using an image observer can get you in trouble, e.g. if argb
> is not completely loaded when you try to draw it on bb. But you get the
> idea.
>
> /Thomas
I tried that method first but what I got was a all black image --
darkness, darkness, be my pillow...
When I tried blue&white instead of black&white, what I got was a all
blue image -- deep deep sea all around us...
----------------------------------------
byte b = (byte)255;
    icm = new IndexColorModel
     (1, 2, new byte[]{0, b}, new byte[]{0, b}, new byte[] {b, b});
bw = new BufferedImage(scrw, scrh, TYPE_BYTE_BINARY, icm);
----------------------------------------

---
 * 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 | NextPrevious in thread | Next in thread | Find similar


Thread

How to do image-type conv "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
  Re: How to do image-type "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
    Re: How to do image-type "Thomas Fritsch" <thomas.fritsch@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
  Re: How to do image-type "Thomas Weidenfeller" <thomas.weidenfeller@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
  Re: How to do image-type "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000

csiph-web