diff --git a/docs/user-interface/graphics/images.md b/docs/user-interface/graphics/images.md index b7308f0c7..58b89df86 100644 --- a/docs/user-interface/graphics/images.md +++ b/docs/user-interface/graphics/images.md @@ -287,6 +287,7 @@ if (image != null) using (MemoryStream memStream = new MemoryStream()) { newImage.Save(memStream); + // Reset destination stream position to 0 if saving to a file } } ``` @@ -294,3 +295,6 @@ if (image != null) ::: moniker-end In this example, the image is retrieved from the assembly and loaded as a stream. The image is downsized using the method, with the argument specifying that its largest dimension should be set to 150 pixels. In addition, the source image is disposed. The downsized image is then saved to a stream. + +> [!IMPORTANT] +> The method doesn't reset the stream position to 0. Therefore, if you want to save the stream to a file you should use the method to reset the destination stream position to 0 before copying it to a file.