IRONSOFTWAREHOME
Generate AnyBitmap
using IronSoftware.Drawing;
using System;
using System.IO;

AnyBitmap bitmap;

// Generate AnyBitmap using filepath
bitmap = AnyBitmap.FromFile(@"FILE_PATH");
bitmap.SaveAs("output.bmp");

// Generate AnyBitmap from bytes
byte[] bytes = File.ReadAllBytes(@"FILE_PATH");
bitmap = AnyBitmap.FromBytes(bytes);
bitmap.SaveAs("result.bmp");

// Generate AnyBitmap from memory stream
byte[] bytes2 = File.ReadAllBytes(@"FILE_PATH");
MemoryStream ms = new MemoryStream(bytes2);
bitmap = AnyBitmap.FromStream(ms);
bitmap.SaveAs("output.bmp");

// Generate AnyBitmap from Uri
Uri uri = new Uri("URI_PATH");
bitmap = await AnyBitmap.FromUriAsync(uri);
bitmap.SaveAs("uriImage.bmp");

// Generate AnyBitmap file from SVG file
bitmap = AnyBitmap.FromFile(@"FILE_PATH.svg");
bitmap.SaveAs("result.jpg");


NuGet Download
PM > Install-Package IronSoftware.System.Drawing
Generate AnyBitmap

Generate AnyBitmap

In order for users to use the IronDrawing tool to open, read, and manipulate image files, AnyBitmap type files must first be generated. There are a number of methods to load image files and generate AnyBitmap files.

File Path

Image files can be loaded from the local machine by using the AnyBitmap.FromFile(@"FILE_PATH") method. This method loads an image file from the given file path and stores it into an AnyBitmap variable, thus generating an AnyBitmap file.

Memory Stream

An AnyBitmap file can also be generated from a memory stream. The bytes of an image will be read and stored in byte arrays using the File.ReadAllBytes(@"FILE_PATH") method. The AnyBitmap file will then be generated from the bytes and stored in an AnyBitmap variable using the AnyBitmap.FromBytes(byte[]) method.

SVG File

AnyBitmap can also be generated from an SVG file using the file path, similar to generating AnyBitmap from a normal file path. However, to load an SVG file into the program, additional dependencies such as SkiaSharp and SkiaSharp.Svg must be added.

Uniform Resource Identifier (URI)

IronDrawing can also generate an AnyBitmap directly from a URI. Users need to initiate and store the URI path into a Uri type variable. The AnyBitmap file is generated by passing the Uri variable to the AnyBitmap.FromUri(uri) 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