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


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

Re: How to do image-type

From "Thomas Weidenfeller" <thomas.weidenfeller@THRWHITE.remove-dii-this>
Subject Re: How to do image-type
Message-ID <ejk2j4$m8m$1@news.al.sw.ericsson.se> (permalink)
Newsgroups comp.lang.java.gui
References <1163755756.272634.317060@m7g2000cwm.googlegroups.com>
Date 2011-04-27 15:25 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
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
-- 
The comp.lang.java.gui FAQ:
http://gd.tuwien.ac.at/faqs/faqs-hierarchy/comp/comp.lang.java.gui/
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq

---
 * 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