|
|
Here we convert a jpeg image into GIF, reducing its colors to 16
and making sure that white, black, red and green are included in
the final output.
[C#]
using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/jeremy-bishop-_CFv3bntQlQ-unsplash.jpg"))) {
ColorPaletteType plt = new ColorPaletteType(ColorPaletteFamily.Exact) { MaxSize = 16 };
plt.FixedColors = new List<Color>(new Color[] { Color.White, Color.Black, Color.Red, Color.Green });
EncoderParameters pars = new EncoderParameters() { Palette = plt };
bm.Save(Server.MapPath("IG8_Palette_70.gif"), ImageFormat.Gif, pars);
}

jeremy-bishop-_CFv3bntQlQ-unsplash.jpg

IG8_Palette_70.gif
|