cpprestsdk icon indicating copy to clipboard operation
cpprestsdk copied to clipboard

Send BYTE* image data as image response

Open pranthakur opened this issue 6 years ago • 1 comments

I have image in the form of raw BYTE* data I want to convert it into jpeg and webp encoding and send it as a response. Is that possible??

pranthakur avatar Aug 25 '18 16:08 pranthakur

you can try with data is opencv mat: vector buf; imencode(".jpg", frame, buf, std::vector() ); concurrency::streams::bytestream byteStream = concurrency::streams::bytestream(); concurrency::streams::istream inputStream = byteStream.open_istream(buf); web::http::http_response response(web::http::status_codes::OK); response.set_body(std::move(inputStream), U("image/jpg"));

hoangpmb avatar Aug 22 '22 10:08 hoangpmb