title: java pgm 2 jpeg/png
body: <p>I have an int array containing gray scale values from 0-254, i also have the x and y size of the image. It is an easy thing to create an pgm image, but i want to display it in a jsp, so i need somehow to convert it to a jpeg or png image. 
  If you suggest jai, than please tell me at which classes to look, or how to actually do it in jai.
  Thanks a lot, in advance.</p>