AnyBitmap to System.Drawing.Bitmap in .NET Framework
In a .NET Framework desktop app such as WinForms, assigning an IronBarcode AnyBitmap directly to a System.Drawing.Image or Bitmap fails at compile time. A common case is binding a generated barcode to a PictureBox, which only accepts System.Drawing.Image objects.
Cannot implicitly convert type 'IronSoftware.Drawing.AnyBitmap' to 'System.Drawing.Image'
The code below triggers the error:
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
// These lines cause compile-time errors
Image myBarcodeImage = myBarcode.Image;
Bitmap myBarcodeBitmap = myBarcode.ToBitmap();
Both BarcodeWriter.Image and .ToBitmap() return an IronSoftware.Drawing.AnyBitmap. That type does support implicit conversion to System.Drawing.Bitmap or Image, but only on .NET 6, .NET 7, .NET 8, or higher. On .NET Framework the implicit operators and internal type bridging do not always resolve, especially when the types come from different libraries or compatibility layers.
Solution
Option 1: Install System.Drawing.Common
Add the System.Drawing.Common NuGet package so the conversion operators resolve against a consistent drawing assembly.
.NET CLI:
dotnet add package System.Drawing.Common
Package Manager Console:
Install-Package System.Drawing.Common
SDK-style .csproj:
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
Option 2: Convert Through a Stream
When you would rather not change package references, convert the bitmap through a GDI-compatible stream and hand the result to the PictureBox:
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
myBarcode.ResizeTo(400, 100); // Optional resizing
using (var ms = myBarcode.ToWindowsBitmapStream())
{
pictureBox1.Image = Image.FromStream(ms); // Works in .NET Framework
}
ToWindowsBitmapStream() writes the AnyBitmap to a GDI-compatible image format, and Image.FromStream parses that stream into a native System.Drawing.Image.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.