Added support for reading images from streams.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>