I want to recolor an Image in C# such that it preserves the real image (just as we do in any Photo Editor). I am trying to do this but of no use. Can anybody help me in this regard...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;
namespace Images
{
class Program
{
static void Main(string[] args)
{
try
{
Bitmap img = new Bitmap(@"D:\Image\Chrysanthemum.jpg");
Bitmap NewImage = new Bitmap(img,img.Width,img.Height);
for (int i = 0; i < img.Width; i++)
{
for (int j = 0; j < img.Height; j++)
{
{
NewImage.SetPixel(i, j,Color.FromArgb(0,0,240,0));
}
}
}
NewImage.MakeTransparent();
NewImage.Save(@"D:\Image\1",System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch(System.Exception exc)
{
Console.Write(exc);
}
}
}
}