Thanks.  It turns out the problem was that all the pixels weren't
loaded.  So I put in a loop to call thread.sleep for a second then try
again, and that fixed the problem.

Greg

On Oct 22, 8:56 pm, John LaBanca <[email protected]> wrote:
> Here is an 
> example:http://www.exampledepot.com/egs/java.awt.image/Image2Buf.html
>
> More 
> examples:http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=Image+to+Buff...
>  <http://www.exampledepot.com/egs/java.awt.image/Image2Buf.html>
> Thanks,
> John LaBanca
> [email protected]
>
> On Fri, Oct 22, 2010 at 5:20 PM, Greg Dougherty
> <[email protected]>wrote:
>
> > Hi all,
>
> > So here's my challenge:
>
> > I have code that gives me a java.awt.Image that is NOT a
> > BufferedImage.  The only Java code I can find for saving an image
> > requires you to have a BufferedImage.  I found some code that should
> > make a BufferedImage from an Image:
>
> >        int     type = BufferedImage.TYPE_INT_RGB;
> >        int     width = theImage.getWidth (null);
> >        int     height = theImage.getHeight (null);
>
> >        BufferedImage   bufferedImage = new BufferedImage (width, height,
> > type);
> >        if (!bufferedImage.getGraphics().drawImage(theImage, 0 , 0, null))
> >                return null;
>
> >        return bufferedImage;
>
> > This code works every time, when I single step through the debugger.
> > However, when I try to just run the code, it fails every time.
>
> > 1: Is there a way to write an Image that isn't a BufferedImage to
> > disk?
> > 2: Is there a good way to send a java.awt.Image to a GWT client?
> > 3: Is there any reason why the above code should not work in a
> > servlet?
>
> > TIA,
>
> > Greg
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-web-toolkit%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to