You can use the Java ImageIO standard library ImageIO . It offers a static write method that can, for example, encode and write a RenderedImage to a PNG output stream. For RenderedImage you can easily use the BufferedImage class. It offers a setRGB method for directly controlling the colors of individual pixels. Alternatively, you can also call BufferedImage.getGraphics() , which returns a Graphics instance that you can draw any shape or text, or even entire GUI components, like any AWT component.
This is regular Java stuff. Scala does not offer any special wrappers for this, and I also doubt that it will be worth the effort.
Madoc source share