Generate AnyBitmap
In order for users to use 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 local machine by using AnyBitmap.FromFile(@"FILE_PATH")
method and store it into an AnyBitmap
variable to generate an AnyBitmap
file.
Memory stream
AnyBitmap
file can also be generated from memory stream. The bytes of an image will be read and stored in byte arrays using File.ReadAllBytes(@"FILE_PATH")
method. AnyBitmap
file will then be generated from the bytes and stored in AnyBitmap
variable using AnyBitmap.FromBytes(byte [])
method.
SVG file
AnyBitmap
can also be generated from SVG file using the file path similar to generating AnyBitmap
from file path. However, to load an SVG file to the program, additional dependencies such as SkiaSharp
and SkiaSharp.Svg
must be added.
Uniform Resource Identifier (URI)
IronDrawing also can generate AnyBitmap
directly from URI. Users need to initiate and store the URI path into a URI type variable Uri uri = new Uri("URI_PATH");
and generate AnyBitmap
file by storing the Uri
variable to AnyBitmap
type variable using AnyBitmap.FromUri(uri)
method.