Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 1.02 KB

UsingColors.md

File metadata and controls

25 lines (20 loc) · 1.02 KB

Using colors

using var image = new MagickImage(SampleFiles.SnakewarePng);

image.TransparentChroma(MagickColors.Black, MagickColors.Blue);
image.BackgroundColor = ColorMono.Black.ToMagickColor();

// Q16 (Blue):
image.TransparentChroma(new MagickColor(0, 0, 0), new MagickColor(0, 0, Quantum.Max));
image.TransparentChroma(new ColorRGB(0, 0, 0).ToMagickColor(), new ColorRGB(0, 0, Quantum.Max).ToMagickColor());
image.BackgroundColor = new MagickColor("#00f");
image.BackgroundColor = new MagickColor("#0000ff");
image.BackgroundColor = new MagickColor("#00000000ffff");

// With transparency (Red):
image.BackgroundColor = new MagickColor(0, 0, Quantum.Max, 0);
image.BackgroundColor = new MagickColor("#0000ff80");

// Q8 (Green):
image.TransparentChroma(new MagickColor(0, 0, 0), new MagickColor(0, Quantum.Max, 0));
image.TransparentChroma(new ColorRGB(0, 0, 0).ToMagickColor(), new ColorRGB(0, Quantum.Max, 0).ToMagickColor());
image.BackgroundColor = new MagickColor("#0f0");
image.BackgroundColor = new MagickColor("#00ff00");