简体   繁体   English

使用图形和位图将更改的图像保存在C#中

[英]Save changed image in c# using graphic and bitmap

I read an image and print some text on it as you can see . 如您所见,我阅读了图像并在其上打印了一些文本。

Bitmap bmp = new Bitmap(@"d:\a.jpg");
RectangleF rectf = new RectangleF(70, 90, 90, 50);
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.DrawString("yourText", new Font("Tahoma", 8), Brushes.Black, rectf);
g.Flush();

How can i save my image and these changes in another location of my computer ? 如何保存图像以及这些更改在计算机的其他位置?

Dispose Graphics object 处置Graphics对象

g.Dispose();

And save Bitmap 并保存位图

bmp.Save(fileName);

Here you have all Bitmap methods include different versions of Save 在这里 ,所有位图方法都包含不同版本的Save

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM