code: public static void write(Image image, String format, OutputStream out, boolean writeAlpha) throws SlickException {
  		try {
  			ImageWriter writer = ImageWriterFactory.getWriterForFormat(format);
  			writer.saveImage(image, format, out, writeAlpha);
  		} catch (IOException e) {
  			throw new SlickException("Unable to write out the image in format: "+format, e);
  		}
  	}
docs: Write an image out to a specified output stream
  
  @param image The image to write out to
  @param format The format to write the image out in
  @param out The output stream to which the image should be written
  @param writeAlpha True if we should write the alpha channel out (some formats don't support this, like JPG)
  @throws SlickException Indicates a failure to write the image in the specified format