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.