Merge two images to create a single image in C#.Net

后端 未结 6 1026
庸人自扰
庸人自扰 2020-12-13 14:00

I have a requirement wherein I need to merge two different png/jpeg images resulting into a single image using C#.Net. There will be a particular location defined on the sou

6条回答
  •  醉话见心
    2020-12-13 14:37

    Disclaimer: I work at Atalasoft

    Our DotImage Photo SDK (which is free) can do this.

    To open an image

     AtalaImage botImage = new AtalaImage("bottomImage.png");
     AtalaImage topImage = new AtalaImage("topImage.png");
    

    To overlay one on top of another

     Point pos = new Point(0,0); // or whatever you need
     OverlayCommand cmd = new OverlayCommand(topImage, pos);
     ImageResults res = cmd.Apply(botImage);
    

    If you need the resulting image to be a different size, look at the CanvasCommand. You could also create an AtalaImage of the size you need, then overlay each image onto it.

    To save

     botImage.Save("newImage.png", new PngEncoder(), null);
    

提交回复
热议问题