在图像中添加文字 [英] add text in image

查看:86
本文介绍了在图像中添加文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
这是在图像中添加文本的方法.问题是当我将图像保存在硬盘上时,图像文件的大小已更改.有人可以指导我如何在具有超背景的图像中添加文本.
在这里

Hi Every body,
here is something to add text in an image. The problem is the image file size is changed when I saves the image on harddisk. can someone guide me how I can add text in an image with transperent background.
here it goes

public static Bitmap   insertTextInImage(string Path,string Text)
{
    Bitmap myBitmap = new Bitmap(Path);
    Graphics g = Graphics.FromImage(myBitmap);
    StringFormat strFormat = new StringFormat();
    strFormat.Alignment = StringAlignment.Center;
    g.DrawString(Text, new Font("Tahoma", 10), Brushes.Black ,
        new RectangleF(0, 0, 140, 50), strFormat);

    return myBitmap;
}

推荐答案

我认为您正在寻找图像上的水印.您可以尝试以下操作:
1. 使用GDI + for .NET创建带水印的照片 [在C#中构建简单的水印实用程序 [
I think that you are looking for Water-marking on an image. You can try these:
1. Creating a Watermarked Photograph with GDI+ for .NET[^]
2. Build a simple watermarking utility in C#[^]


这篇关于在图像中添加文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆