none
Overlaying Images with Transparency RRS feed

  • Question

  • I would like to create a program where you overlay images together with different transparency. You control each image with a trackBar. There needs to be a display and be able to export it as a png. How would I go about this task? Keep in mind I have never worked with any sort of images before.
    Friday, June 7, 2013 10:05 AM

Answers

  • Hi,

      Welcome to MSDN Forum Support.

      I feel that you can try using this code snippet to merge three image into one image looks like overlaying.

     
    Bitmap gbkn = new Bitmap(7001, 7001, Imaging.PixelFormat.Format32bppArgb);
    Graphics g = Graphics.FromImage((Image)gbkn);
    Image img = Image.FromFile("C:\\background.png");
    g.DrawImage(img, new Point(0, 0));
    img.Dipose();
    img As Image = Image.FromFile("C:\\firstlayer.png");
    g.DrawImage(img, new Point(0, 0));
    img.Dispose();
    img As Image = Image.FromFile("C:\\secondlayer.png");
    g.DrawImage(Image.FromFile("C:\\secondlayer.png"), new Point(0, 0));
    img.Dispose();

      Consequently, you should use System.Drawing Namespace that is used to access Bitmap and Graphics classes whereas System.Drawing.Imaging Namespaces is used to access ColorMatrix and ImageAttributes.  You can use two object named ColorMatrix and ImageAttributes to implement it. Here is it detailed introduction.

     

      Sincerely,

      Jason Wang


    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, June 10, 2013 4:19 AM