Easiest Way to Draw an Image as Water/Oil paint Image

Easiest way to draw an image as Water/Oil paint image.

Introduction

While analysis an image with Image Processing I get this easy logic to draw an image like a water paint i.e., a photo taken in by a digital camera will have very clear point and edges according to its pixel. So the main concept is to sharing the edges and point by sharing its neighbouring pixel to smooth edges and provide a brush touch.

Concept behind the approach

AS we know that an image pixel contains for value i.e., ARGB. The A value is the responsible for transparency of the pixel. So here the simple logic is that we create a copy of image with high transparency. And while getting the pixel lowest transparent image, it always shared with is
neighbouring pixel.

C# Code behind the approach

var bmp = new Bitmap(Bitmap.FromFile("../../originalImage.png")); //Actual clear image

var transparentbmp = new Bitmap(bmp.Width, bmp.Height); // To Hold transparent image

var waterPaintbmp = new Bitmap(bmp.Width, bmp.Height); // To hold water paint image

 

for (int row = 0; row < bmp.Width; row++) // Indicates row number

{

     for (int column = 0; column < bmp.Height; column++) // Indicate column number

     {

          var color = bmp.GetPixel(row, column); // Get the pixel from each and every row and column

          transparentbmp.SetPixel(row, column, Color.FromArgb(10, color.R, color.G, color.B)); // Set A value as 10

     }

}

 

transparentbmp.Save("../../Image.png", ImageFormat.Png); // Save the transparent image

bmp = new Bitmap(Bitmap.FromFile("../../Image.png")); // Load the transparent image

for (int row = 0; row < bmp.Width; row++) // Indicates row number

{

    for (int column = 0; column < bmp.Height; column++) // Indicate column number

    {

        var color = bmp.GetPixel(row, column); // Get the pixel from each and every row and column

        waterPaintbmp.SetPixel(row, column, Color.FromArgb(255, color.R, color.G, color.B)); // Set A value as 255

    }

}

waterPaintbmp.Save("../../WaterPaint.png", ImageFormat.Png); // Save the water paint image

Image1.jpg

Conclusion

Hence whenever we get the pixel of the high transparent it will share its neighbour pixel that provide you the brush touch. Also the value of the transparency will determine the patch and thickness of the brush.