summary refs log tree commit diff
path: root/third_party/blurhash/blurhash.hpp
blob: e01b9b3f9b038b4218af19c15a3f1827ea85619b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include <string>
#include <string_view>
#include <vector>

namespace blurhash {
struct Image
{
        size_t width, height;
        std::vector<unsigned char> image; // pixels rgb
};

// Decode a blurhash to an image with size width*height
Image
decode(std::string_view blurhash, size_t width, size_t height, size_t bytesPerPixel = 3);

// Encode an image of rgb pixels (without padding) with size width*height into a blurhash with x*y
// components
std::string
encode(unsigned char *image, size_t width, size_t height, int x, int y);
}