Skip to content

Instantly share code, notes, and snippets.

View anthonyec's full-sized avatar
🐢
eat the food and live

Anthony Cossins anthonyec

🐢
eat the food and live
View GitHub Profile
@anthonyec
anthonyec / DominantColors.cs
Created May 19, 2016 12:26 — forked from JimBobSquarePants/DominantColors.cs
An ImageProcessor Core equivalent to the output described at https://manu.ninja/dominant-colors-for-lazy-loading-images
/// <summary>
/// Returns a 1x1 pixel Base64 encoded gif from the given image containing a single dominant color.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="string"/></returns>
public static string ToBase64GifPixelString(this Image source)
{
// Leave the original image intact
using (Image temp = new Image(source))
{