dub test --debug=featureTest
import dlib.image;
import dlibwebp;
void main() {
auto img = loadPNG("input.png");
// Medium quality.
img.saveWEBP("quality.webp");
img.saveWEBP("q50.webp", 50);
img.saveWEBP("hq.webp", WEBPQuality.HIGH);
// But it is still YUV 4:2:0.
img.saveWEBP("q100.webp", WEBPQuality.HIGHEST);
// And it is not.
img.saveWEBP("lossless.webp", WEBPQuality.LOSSLESS);
// You may want to use the streaming API
// just like savePNG, saveTGA, etc.
// auto res = img.saveWEBP(outputStream, 50);
// Also, you can save to arrays:
// ubyte[] lossy = img.saveWEBPToArray();
// ubyte[] lossy50 = img.saveWEBPToArray(50);
// ubyte[] lossless = img.saveWEBPToArray(WEBPQuality.LOSSLESS);
// And back.
auto readBack = loadWEBP("lossless.webp");
readBack.savePNG("lossless.png");
// Also available:
// loadWEBP(inputStream)
// loadWEBP(ubyte[])
}
Boost Software License, Version 1.0 http://www.boost.org/LICENSE_1_0.txt
Dependencies:
- libwebp BSD 3-clause
- dlib Boost Software License, Version 1.0
- feature-test-d (for testing) MIT