IRONSOFTWAREHOME
Bitmap to Stream
using IronSoftware.Drawing;
using System.IO;

AnyBitmap bitmap = AnyBitmap.FromFile(@"FILE_PATH");

// Get stream of AnyBitmap
MemoryStream stream = bitmap.GetStream();

// Convert AnyBitmap to stream
MemoryStream stream1 = bitmap.ToStream();

NuGet Download
PM > Install-Package IronSoftware.System.Drawing
Bitmap to Stream

Bitmap to Stream

AnyBitmap generated from a program or opened from a file directory in a user's computer can be converted to a memory stream to be used further in the program without the need to create temporary buffers and files in an application. In this code example, we provide a simple way to obtain a stream and to convert an AnyBitmap file loaded from a local directory to a memory stream.

Get Stream

This function is used to obtain the stream from a particular AnyBitmap file. Simply assign a MemoryStream variable to store the memory stream from an AnyBitmap file obtained using the AnyBitmap.GetStream() method.

To Stream

This function is used to convert an AnyBitmap file to a memory stream. Simply assign a MemoryStream variable to store the value of the AnyBitmap file converted to a memory stream using the AnyBitmap.ToStream() method.

View on GitHub

Ready to Get Started?

Nuget Downloads 20,033,450Version:2025.3just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required