Skip to content

How to replace a pixel of a specified color with another color #1502

Answered by JimBobSquarePants
wf-soft asked this question in Q&A
Discussion options

You must be logged in to vote

Here's two ways to do it. Available on Image<TPixel> and individual frames.

For a given pixel at position x, y

// Image = Image<TPixel>
image[x, y] = ...

For operating on multiple pixels on the same row.

// Image = Image<TPixel>
Span<TPixel> row = image.GetPixelRowSpan(y);
row[x] = ...

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@smhoff
Comment options

@JimBobSquarePants
Comment options

Answer selected by JimBobSquarePants
Comment options

You must be logged in to vote
3 replies
@wf-soft
Comment options

@antonfirsov
Comment options

@wf-soft
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants