Skip to content
Discussion options

You must be logged in to vote

You are pretty close. Below is an example of what you could do to export the pixels instead:

using var image = new MagickImage();
image.Read(screenshotFile);

if (blackAndWhite)
{
    // Maybe gets you a better result ?
    image.Alpha(AlphaOption.Off);
    image.Threshold(new Percentage(95));

    // This will make your image monochrome.
    image.ColorType = ColorType.Bilevel;
}

// This will export the pixels of the image.
using var pixels = image.GetPixelsUnsafe();
pixels.ToByteArray("R");

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mu88
Comment options

@dlemstra
Comment options

@mu88
Comment options

Answer selected by mu88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants