Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the pixels from a jpeg with ImageSharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using System;
using System.IO;
namespace ImageSharpConsole
{
class Program
{
static void Main(string[] args)
{
try
{
System.IO.Directory.CreateDirectory("output");
}
catch
{
Console.WriteLine("Output directory could not be created");
}
using(Image image = Image.Load(@"C:\Users\john.ingle\source\repos\ProcessingWebApp\ImageSharpConsole\foxlogo.jpg"))
{
image.Clone(x => x.Pixelate(32))
.Save("output/test.jpg");
for(int i = 0; i < image.Height; i++)
{
for(int j = 0; j < image.Width; j++)
{
var pixel = image.GetPixel(i, j);
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.