How to embed an image into another image using C#?

梦想与她 提交于 2019-12-24 00:52:15

问题


In my project user will upload an image and the logo of project will be attached(Embeded) to the bottom of the image.

Is it possible to implement?

If yes then how to implement that?

Please help.


回答1:


Some people call this watermarking, I would search around for that.

Have a look at http://www.codeproject.com/KB/GDI-plus/watermark.aspx




回答2:


Yes it is possible to implement.

Look at the System.Drawing namespace.

You can use the Bitmap class - it will allow you to load images from files.

Create two bitmaps, one from each image then you should be able to impose the logo image onto the other one.

This is one fun example of how to do it:

Image backImg = Image.FromFile("bg.jpg");
Image mrkImg = Image.FromFile("watermark.png");
Graphics g = Graphics.FromImage(backImg);
g.DrawImage(mrkImg, backImg.Width/2, 10);
backImg.Save("result.jpg");


来源:https://stackoverflow.com/questions/1945907/how-to-embed-an-image-into-another-image-using-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!