Error: cannot convert from 'System.IO.StreamWriter' to 'System.IO.Stream' #2513
-
I am trying to use the image.Save(stream, encoder) method to write an image to stdout as follows:
but I get the following error:
I have searched online trying to understand the difference between System.IO.StreamWriter and System.IO.Stream without much success. I tried casting but that didn't work. Any help would be much appreciated. Is it even possible to use Image.Save in this manner? Regards, Daryl |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This should work (untested). var stdout = Console.OpenStandardOutput()
image.Save(stdout, new JpegEncoder());
stdout.Flush() Ths issue you are hitting is that you are using the API/streams completly wrong, You are trying to pass a |
Beta Was this translation helpful? Give feedback.
This should work (untested).
Ths issue you are hitting is that you are using the API/streams completly wrong, You are trying to pass a
StreamWriter
(which is a type for simplifying wrting text to a stream) instead of the stream itself.