2

I use VS 2012 - .NET 4.5.

I have any image. Now, I want France flag cover (image effect) about my image like Facebook does France flag facebook cover, maybe applies effects for colors f40323,ffffff,228eff (Red, White, and Blue), opacity and direction: changes the stripe direction Values: horizontal, vertical, diagonalleft, diagonalright, chevronhorizontal, chevronvertical

I think, using Graphics.FillRectangle(Brushes.Blue

Any suggestions?

http://rainbowfilter.io/france?colors=f40323,ffffff,228eff

http://progzoo.net/wiki/C%23:Flags_with_Rectangles_Tutorial

static void drawFlag(Graphics g)
{
  g.FillRectangle(Brushes.Blue,100,0,100,200);
}
  • Using GDI+ you won't get any more sophisticated effects than using a semitransparent color: `SolidBrush brush = new SolidBrush(Color.FromArgb(96, Color.Blue));` You can play with the alpha and try other hues, of course. – TaW Nov 15 '15 at 22:45
  • 2
    You can have a semi transparent image of France's flag and then use it to [overlay](http://stackoverflow.com/questions/13068065/how-do-i-overlay-an-image-in-net) the original image. – Matias Cicero Nov 15 '15 at 22:51

1 Answers1

2

You can create a semi transparent (PNG) image of France and then

Image ImgPic = Image.FromFile("AvtarPic.png");
Image FranceFlagOverlay = Image.FromFile("FranceFlag.png");

Image img = new Bitmap(ImgPic.Width, ImgPic.Height);
using (Graphics gr = Graphics.FromImage(img))
{
    gr.DrawImage(ImgPic, new Point(0, 0));
    gr.DrawImage(FranceFlagOverlay, new Point(0, 0));
}
img.Save("ImgPicWithFranceFlagOverlay.png", ImageFormat.Png);
Mohit S
  • 13,723
  • 6
  • 34
  • 69