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+BufferedImage
 <http://www.exampledepot.com/egs/java.awt.image/Image2Buf.html>
Thanks,
John LaBanca
jlaba...@google.com


On Fri, Oct 22, 2010 at 5:20 PM, Greg Dougherty
<dougherty.greg...@mayo.edu>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 google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> 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 google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to