BitmapEncoder.Save(Stream) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Encodes a bitmap image to a specified Stream.
public:
virtual void Save(System::IO::Stream ^ stream);
[System.Security.SecurityCritical]
public virtual void Save (System.IO.Stream stream);
public virtual void Save (System.IO.Stream stream);
[<System.Security.SecurityCritical>]
abstract member Save : System.IO.Stream -> unit
override this.Save : System.IO.Stream -> unit
abstract member Save : System.IO.Stream -> unit
override this.Save : System.IO.Stream -> unit
Public Overridable Sub Save (stream As Stream)
Parameters
- stream
- Stream
Identifies the file stream that this bitmap is encoded to.
- Attributes
Exceptions
The bitmap has already been encoded.
The Frames count is less than or equal to zero.
Examples
The following example demonstrates how to save a bitmap image to a file stream by using the derived TiffBitmapEncoder class.
FileStream stream = new FileStream("empty.tif", FileMode.Create);
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();
encoder.Frames.Add(BitmapFrame.Create(image));
MessageBox.Show(myPalette.Colors.Count.ToString());
encoder.Save(stream);
Dim stream As New FileStream("empty.tif", FileMode.Create)
Dim encoder As New TiffBitmapEncoder()
Dim myTextBlock As New TextBlock()
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString()
encoder.Frames.Add(BitmapFrame.Create(image))
MessageBox.Show(myPalette.Colors.Count.ToString())
encoder.Save(stream)
Remarks
In the context of this API, "save" and "encode" are synonymous.
Applies to
See also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈