Skip to content

dlib.image

Timur Gafarov edited this page Dec 16, 2015 · 26 revisions

dlib.image

Image processing package. This part of dlib is under active development, but the main API is stable enough: we only add new functionality and make cosmetic changes.

dlib.image is most well-suited for computer scientist's everyday image manipulation tasks. It may be used as a plotting/rendering backend, or an easy to use texture loader for games and demos. It is not (and probably not going to be) a full-blown graphics engine to compete with GEGL or Cairo. But if all you want is to write some pixels to PNG, dlib.image is the fastest way to get the job done without hassle.

Modules

dlib.image.image

Usage example

Fill image with a color in HSV colorspace:

import dlib.image;

SuperImage fillHSV(
    SuperImage img,
    float h,
    float s,
    float v,
    float a = 1.0f)
{
    foreach(x; img.row)
    foreach(y; img.col)
    {
        img[x, y] = hsv(h, s, v, a);
    }
    return img;
}

void main()
{
    image(100, 100).fillHSV(180.0f, 1.0f, 0.4f).savePNG("test.png");
}
Clone this wiki locally