-
-
Notifications
You must be signed in to change notification settings - Fork 33
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 mostly 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. And it also supports animated images.
dlib.image supports several popular image formats:
PNG | APNG | BMP | TGA | JPEG | HDR | |
---|---|---|---|---|---|---|
load | yes | yes | yes | yes | yes | yes |
save | yes | yes | yes | yes | no | no |
dlib.image.color - standard RGBA color representation used across the package dlib.image.image - LDR image classes dlib.image.hdri - HDR image class dlib.image.animation - animated images dlib.image.hsv - HSV color space dlib.image.arithmetics - arithmetic operations for images dlib.image.transform - linear transformations for images dlib.image.fthread - a class that simplifies running filters in a separate thread dlib.image.parallel - multithreaded image processing dlib.image.signal2D - FFT and pixel data in frequency domain dlib.image.compleximage - RGB image composed out of frequency data
dlib.image.filters - various image filters and effects dlib.image.io - saving and loading image file formats dlib.image.render - drawing shapes and patterns dlib.image.resampling - image resizing using various interpolation methods
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");
}