Miss said:
I guess I should've specified the problem a bit more...
I think I answered your question... let's see if we can find the
miunderstanding here.
I have a java task which occasionally creates an image (on a canvas),
By "on a canvas" do you mean a java.awt.Canvas object? That was my
assumption. Perhaps you mean something else.
No, no, no... I don't want to have an applet just draw directly on my
web-page. I'm trying to create image-format files! Robot's screen
capture, in addition to spotty availability, has the problem of only
working on the screen.
Well, my understanding was that you'd already drawn on the screen (on a
java.awt.Canvas) and were now trying to recover the image back again so
that you could save it in a file. I guess I was wrong about that.
In any case, I recommended against that solution anyway. If it doesn't
work for you, then don't use it. Instead, draw onto a BufferedImage and
use the java.imageio package.
So, javax.imageio sounds promising, although initial quick-skim didn't
turn up anything like "writeGIFfile()" -- but I'll keep reading.
It's one of:
ImageIO.write(RenderedImage,String,File)
ImageIO.write(RenderedImage,String,OutputStream)
Which you choose depends on your desires; the latter is more flexible,
but requires that you open and close the file's OutputStream on your
own. The middle parameter is unclear from the documentation, but can be
set to "GIF" or "JPG" or "PNG".
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation