I am using ImageSharp
(ver 1.0.0-beta0006) in my .Net Core 2.2 project. I primarily use it to resize image (to generate thumbnail) and it's working fine.
Recently, I've got a requirement to draw rectangles on the image. Based on the documentation, this is what I've got to do:
using (var image = new Image<Rgba32>(800, 800))
{
image.Mutate(x => x.DrawLines(
Rgba32.HotPink,
10,
new SixLabors.Primitives.PointF[] {
new Vector2(10, 10),
new Vector2(550, 50),
new Vector2(200, 400)
}));
using (var stream = new MemoryStream())
{
image.SaveAsBmp(stream);
}
}
However, I realize that in my Mutate
lambda methods there is not a method named DrawLines
. Can I know if I'm missing an assembly? Based on the documentation, it is using
:
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.PixelFormats;
both of which are found in the SixLabors.ImageSharp
package.
Install SixLabors.ImageSharp.Drawing
and you should be able to find the missing methods/extensions.
Image sharp is split into 2 main libraries, the main SixLabors.ImageSharp
which deals with the core image decoding/encoding and pixel pushing, then there is SixLabors.ImageSharp.Drawing
which handles various drawing sub systems, vector drawing, text rendering etc.