Graphics Library

The external graphics library is a complement to the types in the standard library. It provides the ability to load images from a number of common file formats, either from disk or from a stream.

The graphics library is located in the package graphics, and entirely implemented in a single shared library. Since this is an external library, it does not need to be distributed alongside applications where it is not needed.

The library simply provides the following two functions:

The library currently supports the following file formats:

On Linux, the graphics library uses libpng for decoding PNG images, and libjpegturbo for JPEG images. On Windows, the Windows Imaging API is used. BMP and PPM use custom implementations that support the most common image types. For example, this means that compressed BMP formats will not work.