-
-
Notifications
You must be signed in to change notification settings - Fork 33
dlib.image
Timur Gafarov edited this page Mar 16, 2020
·
26 revisions
Image processing package. 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.
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 | yes |
- 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.canvas - HTML5-like canvas
- dlib.image.signal2D - FFT and pixel data in frequency domain
- 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");
}