在图片上动态的写文字
In my example, I have a picture of my son and I write the words “That’s my boy!”. Also, to show that you can combine graphic drawing and text together, I then draw an oval shape around the word that I just put on the picture.
In order to make this sample work, you need the following references:
using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using System.Drawing.Text;
Also, you might need to play around with where you want your text and oval to go. Remember that both the placement of the text and graphic oval are based on X and Y coordinates. So, if you have to move the text/oval up, then change the value of the Y parameter. If you need to move the text/oval horizontally, then change the value of the X parameter.
There are basically 6 steps for my sample:
- Load your image:
//Load the Image to be written on. Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("dallen.jpg" ) ); Graphics graphicImage = Graphics.FromImage( bitMapImage );
- Set the graphics to be smooth.
//Smooth graphics is nice. graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
- Write your text. Here is where you set your font. The X and Y coordinates are in the new point. (100 = X, 250 = Y).
//Write your text. graphicImage.DrawString( "That's my boy!", new Font("Arial", 12,FontStyle.Bold ), SystemBrushes.WindowText, new Point( 100, 250 ) );
- Draw your oval around the text. Note: play around with the numbers to make the oval to the correct size that you want.
//I am drawing a oval around my text. graphicImage.DrawArc(new Pen(Color.Red, 3), 90, 235, 150, 50, 0, 360);
- Set the Content Type to jpg and then write your image to the response stream.
//Set the content type Response.ContentType="image/jpeg"; //Save the new image to the response output stream. bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);
- Clean up.
//Clean house. graphicImage.Dispose(); bitMapImage.Dispose();
在图片上动态的写文字相关推荐
- 图片上的手写文字怎样才能转换成文档文字?
不知道大家有没有曾遇到过将手写的图片内容转化成文字的情况,那么大家都是怎样操作的呢?不会和小编一样将图片上的文字一点一点的敲打成文档文字的吧!其实生活中是有简单的方法的,今天小编就将这个简单的操作方法 ...
- 如何批量在图片上加统一的文字?
工作中我们对图片的需求可谓是五花八门,比如批量在图片上加上相同的文字,相信不少小伙伴遇到过, 遇到这种情况的时候你一般会怎么处理呢?有些小伙伴会乖乖的用画图工具或PS软件一个一个添加,这样既不能做到统 ...
- php图片写入带问号_php实现图片上传时添加文字和图片水印技巧
本文实现的功能特别适用于一些商城和图片站中,分享了图片在上传时添加文字和图片水印的技巧,供大家参考,具体内容如下 1. water.class.php header('Content-Type:tex ...
- android 图片上动态添加文字,摘抄 android图片中添加文字水印
* 添加文字到图片,类似水印文字. * @param gContext * @param gResId * @param gText * @return */ public static Bitmap ...
- 文字描边加粗_用AE制作动态手写文字效果
现在很多设计师在设计logo或者字体的时候,已经不单纯的停留在固定不动的状态,而是添加了很多动效来提升作品的视觉效果.以现在流行的动效设计来看,可以分为三类:交互动效.MG动效.后期动效. 交互动效: ...
- THREEJS在场景图上动态标识一些文字方法二(文字精灵sprite)
threejs文字精灵sprite的实现 1.手动添加文字精灵 2.通过json动态获取文字精灵,并进行交互 3.point模型只表示位置 4.CircleGeometry实现 5.3.PlaneGe ...
- 绝对神器,今天教你如何识别图片上竖排的日语文字
在文字翻译或者其他的工作中我们经常遇到竖排的日语,有时候我们用普通的日语识别的软件根本无法完成 这个时候我们就需要一款可以识别竖排的日语工具,横排的我们很容易就能找到,但是竖排的就无能为力了 今天我们 ...
- THREEJS实现标签,自定义样式显示标签,在场景图上动态标识一些文字方法一(css2d_label)
方法:css2d_label 特点:显示的标签大小固定,不会随窗口的大小而变化. 注意: 1.引入CSS2DRenderer.js 2.添加渲染器CSS2DRenderer 3.进行渲染CSS2DRe ...
- Android绘图实例(Bitmmap,Canvas,Pain的使用)动态的在图片上添加文字(canvas.drawText)
近些天学习图像处理,今天看见了一段代码中有Bitmap时,找了些Bitmap的资料,有查看了与之有关的绘图类. BitMap代表一张位图,BitmapDrawable里封装的图片就是一个Bitmap对 ...
最新文章
- 第十六届全国大学智能车竞赛华南赛区成绩汇总
- 69. Sqrt(x)(python)
- 解决用户登录查库问题
- ASP.NET Core 2.2+Quartz.Net 实现Web定时任务
- 在Java中使用FileChannel和ByteBuffer对文件进行读写
- 有三个数a,b,c,要求按大小顺序输出。
- Leetcode744.Find Smallest Letter Greater Than Target寻找比目标字母大的最小字母
- Python BeautifuSoup4 爬表格
- vue el-date-picker 直接赋值不生效、数据绑定无效
- php 深入,深入PHP解耦的三重境界(浅谈服务容器)
- “中华优秀科普图书榜”
- c语言二级考试报名费,c语言二级考试(计算机二级c语言报名)
- informix for linux数据库下载,informix for linux安装全攻略(原创)
- redhat装java_redhat下安装java
- 小说网站的源码设计实现
- 临平职高计算机分数线,权威发布!余杭区2017年各类高中招生第一批次录取分数线划定!...
- 微信小程序实现发送短信的功能(发送短信)
- 微信域名防封、域名检测接口api、域名跳转技术、360防拦截揭秘(一)------域名防封的核心技术
- ls 命令显示的total是什么意思
- 先定个小目标,免费360度评价(评估)反馈系统上线,开放部分源码
热门文章
- 亚商投资顾问早餐FM/0310易纲谈金融监管改革
- 台风把汽车的java,台风“利奇马”过后,大批泡水车怎么处理?“去处”让人难以接受...
- 基于微信小程序的客运自助售票小程序的设计与实现
- linux软连接解决深度学习数据集连接问题
- versiondog一个快速可靠的版本控制和自动备份软件
- mysql 表里restrict_数据库的三种状态RESTRICT、QUIESCE和SUSPEND(一)
- PADS 中如何删除自己打的地孔阵列
- 北方网站南方服务器,北方地区与南方地区
- dva框架二级路由刷新出现空白页
- nbsp;和空格区别及去除区别