What is the code you tried?
Be aware that the stream returned by ContentAsStream does not provide a value for Size property - because it retrieves data on demand, it's a forward-only stream that you should use to retrieve chunked data, for example. You must rely only on Read method of that stream. You can also get the content as TBytes, and then transfer those bytes to the image.
A code like this works, for example: