Article View: borland.public.jbuilder.java.api
Article #1173Re: Image pixel inspection
From: James Hughes
Date: Thu, 18 Apr 2002 13:21
Date: Thu, 18 Apr 2002 13:21
36 lines
2231 bytes
2231 bytes
Ok, here is what I have now:
// initialise the Image object
Image gif = Toolkit.getDefaultToolkit().createImage(imageData);
// have to draw the image to find it's size
BufferedImage buff = new BufferedImage(20, 20,
BufferedImage.TYPE_INT_ARGB);
boolean imageReady = buff.getGraphics().drawImage(gif,0, 0, null);
Now, the imageReady has a value of 'false', which means that for some reason
the image is not loaded - why? Also, this means that buff.getRGB(x, y) does
not retrieve the correct values for the pixels - how can I get around this?
Is there a way of forcing the image to load, and if not, can anybody tell me
why not?
Thanks in advance,
J
"John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message
news:MPG.172792c58476aca498b544@newsgroups.borland.com...
> On Wed, 17 Apr 2002 09:04:44 +0100, James Hughes wrote:
>
> > I have got as far as loading the Image into a BufferedImage,
> > but I dont know how to get at the pixels, can anybody help me?
>
> int rgb = bufferedImage.getRGB( x, y );
>
> --
> Regards,
>
> John McGrath [TeamB]
>
> ---------------------------------------------------
> Before sending me e-mail, please read:
> http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<3cbec8d4_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!skynet.be!skynet.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3cbd2d36$1_1@dnews> <MPG.172792c58476aca498b544@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,937c9cd9161d2c82 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2002-04-18 06:37:48 PST Reply-To: "James Hughes" <jimbogaz@hotmail.com> From: "James Hughes" <jimbogaz@hotmail.com> Newsgroups: borland.public.jbuilder.java.api References: <3cbd2d36$1_1@dnews> <MPG.172792c58476aca498b544@newsgroups.borland.com> Subject: Re: Image pixel inspection Date: Thu, 18 Apr 2002 14:21:50 +0100 Lines: 38 Organization: Avoca Communications X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 212.161.14.102 Message-ID: <3cbec8d4_1@dnews> X-Trace: dnews 1019136212 212.161.14.102 (18 Apr 2002 06:23:32 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!skynet.be!skynet.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews