Table of Contents

Class Pixel

Namespace
ImageMagick
Assembly
Magick.NET-Q8-AnyCPU.dll

Class that can be used to access an individual pixel of an image.

public sealed class Pixel : IPixel<byte>, IEquatable<IPixel<byte>?>, IEquatable<IMagickColor<byte>?>
Inheritance
Pixel
Implements
IPixel<byte>
IEquatable<IPixel<byte>>
IEquatable<IMagickColor<byte>>
Inherited Members

Constructors

Pixel(int, int, byte[])

Initializes a new instance of the Pixel class.

public Pixel(int x, int y, byte[] value)

Parameters

x int

The X coordinate of the pixel.

y int

The Y coordinate of the pixel.

value byte[]

The value of the pixel.

Pixel(int, int, uint)

Initializes a new instance of the Pixel class.

public Pixel(int x, int y, uint channels)

Parameters

x int

The X coordinate of the pixel.

y int

The Y coordinate of the pixel.

channels uint

The number of channels.

Properties

Channels

Gets the number of channels that the pixel contains.

public uint Channels { get; }

Property Value

uint

this[uint]

Returns the value of the specified channel.

public byte this[uint channel] { get; set; }

Parameters

channel uint

The channel to get the value for.

Property Value

byte

X

Gets the X coordinate of the pixel.

public int X { get; }

Property Value

int

Y

Gets the Y coordinate of the pixel.

public int Y { get; }

Property Value

int

Methods

Equals(IMagickColor<byte>?)

Determines whether the specified color is equal to the current pixel.

public bool Equals(IMagickColor<byte>? other)

Parameters

other IMagickColor<byte>

The color to compare this pixel with.

Returns

bool

True when the specified color is equal to the current pixel.

Equals(IPixel<byte>?)

Determines whether the specified pixel is equal to the current pixel.

public bool Equals(IPixel<byte>? other)

Parameters

other IPixel<byte>

The pixel to compare this pixel with.

Returns

bool

True when the specified pixel is equal to the current pixel.

Equals(object?)

Determines whether the specified object is equal to the current pixel.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare pixel color with.

Returns

bool

True when the specified object is equal to the current pixel.

GetChannel(uint)

Returns the value of the specified channel.

public byte GetChannel(uint channel)

Parameters

channel uint

The channel to get the value of.

Returns

byte

The value of the specified channel.

GetHashCode()

Serves as a hash of this type.

public override int GetHashCode()

Returns

int

A hash code for the current instance.

SetChannel(uint, byte)

Set the value of the specified channel.

public void SetChannel(uint channel, byte value)

Parameters

channel uint

The channel to set the value of.

value byte

The value.

SetValues(byte[])

Sets the values of this pixel.

public void SetValues(byte[] values)

Parameters

values byte[]

The values.

ToArray()

Returns the value of this pixel as an array.

public byte[] ToArray()

Returns

byte[]

A byte array.

ToColor()

Converts the pixel to a color. Assumes the pixel is RGBA.

public IMagickColor<byte>? ToColor()

Returns

IMagickColor<byte>

A ImageMagick.IMagickColor<> instance.