Joshua Snider
Joshua Snider

Reputation: 797

Download image from url and put in buffer

I get the url for an image at runtime and I'd like to load it into some kind of continguous buffer in memory, arrays or vectors would be perfectly fine. I can only use the std and boost libraries and my google-fu is currently failing me.

EDIT: For people in the future, this is probably something you want to use a third-party library for.

Upvotes: 0

Views: 1082

Answers (1)

cfh
cfh

Reputation: 4666

If you can use additional libraries:

cpp-netlib to download the image data

Any C++ image library to decode the image data; e.g., CImg

Without non-Boost libraries:

Hack your own minimal HTTP client on top of Boost::ASIO (basically, just send a /GET request and read the response).

Use GIL to decode the image.

This approach will be much less reliable though.

Upvotes: 2

Related Questions