Вот моя функция:
Код: Выделить всё
bool save_img(const std::string& buff, const std::string& folder_name, const std::string& file_name, const float qvalitic_factore)
{
if (buff.empty()) return false;
const std::string folder_path = "./static/content/" + folder_name,
img_path = folder_path + "/" + file_name + ".webp";
uint8_t * out = nullptr, *webp = nullptr;
int x, y, n;
out = stbi_load_from_memory((const uint8_t*)buff.c_str(), buff.size(), &x, &y, &n, 3);
if (!out)
{
std::cerr
Подробнее здесь: [url]https://stackoverflow.com/questions/78360870/cant-encode-png-to-webp-with-libwebp-in-c[/url]