Re: ImageIO/BufferedImage behaving inconsistently from one day to the next.
On Wed, 20 Jun 2012 01:16:16 -0700, Roedy Green wrote:
> On Wed, 20 Jun 2012 02:31:00 +0000 (UTC), Fred Greer
> <fggreer@nospam.invalid> wrote, quoted or indirectly quoted someone
> who said :
>>(BufferedImage img
> did you put in MediaTracker wait code for this to load? If you
> didn't sometimes you will try to get the size before it loads.
I'm with Roedy, especially if the situation changed without you doing
anything to the code, I would suspect it to be a timing issue with the
image loading. You haven't show the image loading code, so it's hard to
tell, but try to insert after
public static BufferedImage blur (BufferedImage img) {
a line like
Toolkit.getDefaultToolkit().prepareImage(img, -1, -1, new ImageObserver());
before you try to use the image.
I don't recall off hand, and you'll have to do your own research, but I
think you can just pass null instead of an actual ImageObserver, and of
course this code should really go to where the image is actually loaded.
Liebe Gruesse,
Joerg
--
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.
|