Is there any way through which I can convert a java graphics dynamically to a gif or a jpeg image