Class Image
- Namespace
- ScottPlot
- Assembly
- ScottPlot.dll
Bitmap representation of an image with helper methods for manipulating the image and enabling IO with other platforms
public class Image : IDisposable
- Inheritance
-
Image
- Implements
- Inherited Members
- Extension Methods
Constructors
Image(PixelSize)
Create a black Image with the given dimensions
public Image(PixelSize size)
Parameters
size
PixelSize
Image(SKBitmap)
Create an Image from an existing bitmap
public Image(SKBitmap bmp)
Parameters
bmp
SKBitmap
Image(SKSurface)
Create an Image from the snapshot of an existing Surface
public Image(SKSurface surface)
Parameters
surface
SKSurface
Image(byte[,,])
Create an Image from a 3D array of bytes with axes representing Y position, X position, and Color
public Image(byte[,,] pixelArray)
Parameters
pixelArray
byte[,,]
Image(byte[,])
Create a grayscale Image from a 2D array of bytes. R, G, and B channels will all be set to the given value for each pixel.
public Image(byte[,] pixelArray)
Parameters
pixelArray
byte[,]
Image(byte[])
Create an Image from a byte array of image data encoded in a common file format
public Image(byte[] bytes)
Parameters
bytes
byte[]
Image(int, int)
Create a black Image with the given dimensions
public Image(int width, int height)
Parameters
Image(int, int, Color)
Create an image filled with the given color
public Image(int width, int height, Color color)
Parameters
Image(string)
Create an Image from a file on disk
public Image(string filename)
Parameters
filename
string
Properties
Height
public int Height { get; }
Property Value
SKImage
protected SKImage SKImage { get; }
Property Value
Size
public PixelSize Size { get; }
Property Value
Width
public int Width { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetArrayGrayscale()
Return the image as a 2D byte array grayscale image with axes representing X and Y positions. Grayscale values for each pixel are the mean of R, G, and B channels.
public byte[,] GetArrayGrayscale()
Returns
- byte[,]
GetArrayRGB()
Return the image as a 3D byte array with axes representing X position, Y position, and Color
public byte[,,] GetArrayRGB()
Returns
- byte[,,]
GetAutoscaledImage()
Return a new image with brightness/contrast maximized to fit the range of the data
public Image GetAutoscaledImage()
Returns
GetImageBytes(ImageFormat, int)
Return the image as a platform-agnostic byte array that can be consumed by any common image library
public byte[] GetImageBytes(ImageFormat format = ImageFormat.Png, int quality = 100)
Parameters
format
ImageFormatquality
int
Returns
- byte[]
Render(SKCanvas, PixelRect, SKPaint, bool)
Draw the image onto the given canvas
public void Render(SKCanvas canvas, PixelRect target, SKPaint paint, bool antiAlias)
Parameters
Resized(int, int, bool)
Return a new image resized to fit the given dimensions.
public Image Resized(int newWidth, int newHeight, bool antiAlias = true)
Parameters
Returns
Save(string, ImageFormat, int)
public SavedImageInfo Save(string path, ImageFormat format = ImageFormat.Png, int quality = 85)
Parameters
path
stringformat
ImageFormatquality
int
Returns
SaveBmp(string)
public SavedImageInfo SaveBmp(string path)
Parameters
path
string
Returns
SaveJpeg(string, int)
public SavedImageInfo SaveJpeg(string path, int quality = 85)
Parameters
Returns
SavePng(string)
public SavedImageInfo SavePng(string path)
Parameters
path
string
Returns
SaveWebp(string, int)
public SavedImageInfo SaveWebp(string path, int quality = 85)
Parameters
Returns
Scaled(double, bool)
Return a new image with dimensions scaled by the given scale factor. A scale factor of 2.0 will double the size of the returned image.
public Image Scaled(double scale, bool antiAlias = true)
Parameters
Returns
Scaled(double, double, bool)
Return a new image with dimensions scaled by the given scale factors. A scale factor of 2.0 will double the size of the returned image.
public Image Scaled(double scaleX, double scaleY, bool antiAlias = true)