You are disposing the Bitmap and that will close the stream too. Basically once you give the Bitmap constructor a stream, it “owns” the stream and you shouldn’t close it. As the documents for that constructor say: