matrixion/blurhash.hpp

23 lines
553 B
C++
Raw Normal View History

2020-03-01 15:42:22 +03:00
#pragma once
2020-03-01 22:47:06 +03:00
#include <string>
2020-03-01 15:42:22 +03:00
#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
2020-09-03 22:12:16 +03:00
decode(std::string_view blurhash, size_t width, size_t height, size_t bytesPerPixel = 3);
2020-03-01 15:42:22 +03:00
// 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);
}