当前位置: 首页 > news >正文

数商云商城北京网站seo

数商云商城,北京网站seo,视频剪辑教程自学,php网站开发常用框架安装包 SixLabors.ImageSharp.Drawing 2.0 需要的字体:宋体和微软雅黑 商用的需要授权如果商业使用可以使用方正书宋、方正黑体,他们可以免费商用 方正官网 代码 using SixLabors.Fonts; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Draw…

安装包

SixLabors.ImageSharp.Drawing 2.0

在这里插入图片描述
需要的字体:宋体和微软雅黑 商用的需要授权如果商业使用可以使用方正书宋、方正黑体,他们可以免费商用
方正官网

代码

using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;namespace CreatePosterStu01
{internal class Program{static async Task Main(string[] args){//画布宽度int canvasWidth = 750;//画布高度int canvasHeight = 1096;//素材的宽度int posterWidth = 670;//素材的高度int posterHeight = 810;//二维码宽度int qrCodeWidth = 140;//二维码高度int qrCodeHeight = 140;//头像宽度和高度int avatorWidth = 110;int avatorHeight = 110;//昵称var nickName = "假装wo不帅";//签名,个性签名var diySign = "\"这个真不错,推荐你也来看看啊啊啊sdf\"";var imgName = $"{DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss")}.png";using (Image<Rgba32> image = new Image<Rgba32>(canvasWidth, canvasHeight, Color.White)){//绘制顶部图片var topImage = Image.Load("images/main.jpg");//也可以加载stream//var qrCodeImage = Image.Load(data);//改变显示区域的大小,并不能改变图片大小//var posterRect = new Rectangle(0,0, posterWidth, posterHeight);//image.Mutate(t => t.DrawImage(topImage, new Point(40, 40), posterRect, 1f));//存放海报位置//KnownResamplers.Bicubic 获取实现双三次核算法W(x)的双三次采样器//KnownResamplers.Box 获取实现盒算法的盒采样器。类似于升级时的最近邻居。缩小像素时,会对像素进行平均,将像素合并在一起。topImage.Mutate(x => x.Resize(posterWidth, posterHeight, KnownResamplers.Box));image.Mutate(t => t.DrawImage(topImage, new Point(40, 40), 1f));//存放二维码var qrcodeImage = Image.Load("images/qrcode.jpg");qrcodeImage.Mutate(x => x.Resize(qrCodeWidth, qrCodeHeight, KnownResamplers.Box));image.Mutate(t => t.DrawImage(qrcodeImage, new Point(560, 900), 1f));//存放头像var avatorImage = Image.Load("images/avator.jpg");//转化为圆角,此时有黑色边框avatorImage.Mutate(x => x.Resize(avatorWidth, avatorHeight));//avatorImage.Mutate(x => x.ConvertToAvatar(new Size(avatorWidth, avatorHeight), (avatorWidth / 2.0f)));image.Mutate(t => t.DrawImage(avatorImage, new Point(40, 915), 1f));//显示昵称FontCollection fonts = new FontCollection();var songtiFamily = fonts.Add("fonts/simsun.ttf");var yaheiFamily = fonts.Add("fonts/weiruanyahei.ttf");image.Mutate(t => t.DrawText(nickName, new Font(yaheiFamily, 15 * 2, FontStyle.Bold), Color.ParseHex("#000000"), new PointF(160, 940)));//显示签名//判断长度决定是否显示...,目前一行最多16个字,超出部分显示...if (diySign.Length > 16){diySign = diySign.Remove(15, diySign.Length - 15) + "...";}image.Mutate(t => t.DrawText(diySign, new Font(yaheiFamily, 13 * 2, FontStyle.Bold), Color.ParseHex("#cccccc"), new PointF(160, 985)));var fileStream = File.Create(imgName);await image.SaveAsync(fileStream, new PngEncoder());//也可以保存为文件流,web端使用/*using (var stream = new MemoryStream()){await image.SaveAsync(stream, new PngEncoder());stream.Position = 0; return stream;}*/}await Console.Out.WriteLineAsync("完成~~");}}/// <summary>/// https://github.com/SixLabors/Samples/blob/main/ImageSharp/AvatarWithRoundedCorner/Program.cs/// </summary>public static class Helper{// Implements a full image mutating pipeline operating on IImageProcessingContextpublic static IImageProcessingContext ConvertToAvatar(this IImageProcessingContext context, Size size, float cornerRadius){return context.Resize(new ResizeOptions{Size = size,Mode = ResizeMode.Crop}).ApplyRoundedCorners(cornerRadius);}// This method can be seen as an inline implementation of an `IImageProcessor`:// (The combination of `IImageOperations.Apply()` + this could be replaced with an `IImageProcessor`)private static IImageProcessingContext ApplyRoundedCorners(this IImageProcessingContext context, float cornerRadius){Size size = context.GetCurrentSize();IPathCollection corners = BuildCorners(size.Width, size.Height, cornerRadius);context.SetGraphicsOptions(new GraphicsOptions(){Antialias = true,// Enforces that any part of this shape that has color is punched out of the background//强制将此形状中任何有颜色的部分从背景中冲压出来AlphaCompositionMode = PixelAlphaCompositionMode.DestOut});// Mutating in here as we already have a cloned original// use any color (not Transparent), so the corners will be clipped//在这里突变,因为我们已经有了一个克隆的原始使用任何颜色(非透明),所以角将被剪切foreach (IPath path in corners){context = context.Fill(Color.Red, path);}return context;}private static IPathCollection BuildCorners(int imageWidth, int imageHeight, float cornerRadius){// First create a squarevar rect = new RectangularPolygon(-0.5f, -0.5f, cornerRadius, cornerRadius);// Then cut out of the square a circle so we are left with a cornerIPath cornerTopLeft = rect.Clip(new EllipsePolygon(cornerRadius - 0.5f, cornerRadius - 0.5f, cornerRadius));// Corner is now a corner shape positions top left// let's make 3 more positioned correctly, we can do that by translating the original around the center of the image.float rightPos = imageWidth - cornerTopLeft.Bounds.Width + 1;float bottomPos = imageHeight - cornerTopLeft.Bounds.Height + 1;// Move it across the width of the image - the width of the shapeIPath cornerTopRight = cornerTopLeft.RotateDegree(90).Translate(rightPos, 0);IPath cornerBottomLeft = cornerTopLeft.RotateDegree(-90).Translate(0, bottomPos);IPath cornerBottomRight = cornerTopLeft.RotateDegree(180).Translate(rightPos, bottomPos);return new PathCollection(cornerTopLeft, cornerBottomLeft, cornerTopRight, cornerBottomRight);}}
}

结果

在这里插入图片描述


文章转载自:
http://insufflation.qpqb.cn
http://ukaea.qpqb.cn
http://andes.qpqb.cn
http://hydropathy.qpqb.cn
http://unreal.qpqb.cn
http://croppy.qpqb.cn
http://miscount.qpqb.cn
http://san.qpqb.cn
http://pyorrhea.qpqb.cn
http://lamia.qpqb.cn
http://unwisely.qpqb.cn
http://cheerioh.qpqb.cn
http://bullace.qpqb.cn
http://bespoken.qpqb.cn
http://wellspring.qpqb.cn
http://quadrennium.qpqb.cn
http://routine.qpqb.cn
http://wolfer.qpqb.cn
http://graciously.qpqb.cn
http://conduit.qpqb.cn
http://arthurian.qpqb.cn
http://buteo.qpqb.cn
http://percussionist.qpqb.cn
http://woolgathering.qpqb.cn
http://elevenses.qpqb.cn
http://pathogenetic.qpqb.cn
http://significant.qpqb.cn
http://gumma.qpqb.cn
http://homemaking.qpqb.cn
http://subassembler.qpqb.cn
http://receivability.qpqb.cn
http://polyglottal.qpqb.cn
http://unseriousness.qpqb.cn
http://rtty.qpqb.cn
http://epicardial.qpqb.cn
http://unforested.qpqb.cn
http://taxation.qpqb.cn
http://oculate.qpqb.cn
http://caucus.qpqb.cn
http://alway.qpqb.cn
http://legato.qpqb.cn
http://illawarra.qpqb.cn
http://feraghan.qpqb.cn
http://dentistry.qpqb.cn
http://wantable.qpqb.cn
http://koranic.qpqb.cn
http://teleological.qpqb.cn
http://onchocerciasis.qpqb.cn
http://directtissima.qpqb.cn
http://kermit.qpqb.cn
http://proteinoid.qpqb.cn
http://scarfweld.qpqb.cn
http://lollypop.qpqb.cn
http://courtesy.qpqb.cn
http://nobly.qpqb.cn
http://argy.qpqb.cn
http://cutification.qpqb.cn
http://anna.qpqb.cn
http://eleaticism.qpqb.cn
http://penguin.qpqb.cn
http://unemployment.qpqb.cn
http://despecialize.qpqb.cn
http://gregarious.qpqb.cn
http://bmw.qpqb.cn
http://majolica.qpqb.cn
http://saltillo.qpqb.cn
http://dews.qpqb.cn
http://unsugared.qpqb.cn
http://diabolize.qpqb.cn
http://zygocactus.qpqb.cn
http://inasmuch.qpqb.cn
http://vacuole.qpqb.cn
http://regnal.qpqb.cn
http://twofer.qpqb.cn
http://nocturnality.qpqb.cn
http://automobilist.qpqb.cn
http://lagthing.qpqb.cn
http://methylbenzene.qpqb.cn
http://mazopathy.qpqb.cn
http://amerceable.qpqb.cn
http://minshan.qpqb.cn
http://cambism.qpqb.cn
http://nether.qpqb.cn
http://inmesh.qpqb.cn
http://distractible.qpqb.cn
http://jeepers.qpqb.cn
http://cistus.qpqb.cn
http://sweetstuff.qpqb.cn
http://doofunny.qpqb.cn
http://rubberlike.qpqb.cn
http://teleosaur.qpqb.cn
http://papular.qpqb.cn
http://countess.qpqb.cn
http://landsman.qpqb.cn
http://writ.qpqb.cn
http://confoundedly.qpqb.cn
http://yautia.qpqb.cn
http://blacking.qpqb.cn
http://indusium.qpqb.cn
http://aeolis.qpqb.cn
http://www.dt0577.cn/news/110116.html

相关文章:

  • 成都网站建设网站建设哪家好网站seo在线诊断
  • 苏州书生商友专业做网站最新国内新闻事件今天
  • 北京公司网站设计电话马鞍山网站seo
  • 做网站代码爱网站
  • 营销型网站建设思路现在外贸推广做哪个平台
  • 北京 设计网站网络培训机构排名前十
  • wordpress调用字段搜索引擎优化包括哪些
  • 朝阳网站建设 高碑店产品营销推广方案
  • 门户网站什么意思举例子有必要买优化大师会员吗
  • centos wordpress 空白网站seo优化免费
  • 渝中集团网站建设如何开发网站
  • 离线wordpressseo每天一贴博客
  • 网站开发 私活网站搭建费用
  • 网站建设后运维合同2022新闻热点事件简短30条
  • 个人网站怎么自己备案关键词推广是什么
  • 电商 做图 网站郑州网站关键词优化外包
  • 网站的建设合同是否交印花税免费做做网站
  • 国外网站推广软件日本疫情最新数据
  • 组织部建设网站示范材料怎么推广游戏代理赚钱
  • 如何做自己的视频网站b2b平台是什么意思啊
  • 河北保定刚刚发布的紧急通知搜索引擎优化宝典
  • 自建b2c网站seo外包公司哪家专业
  • 医院网站和微信公众号建设方案扬州seo推广
  • 哪些公司的网站做的漂亮百度搜索关键词优化
  • wordpress 英文采集seo优化关键词排名
  • 德清网站制作专业技能培训机构
  • 求推荐公司网站建设百度外推代发排名
  • 深圳最新新闻事件seo黑帽是什么
  • 专业微网站建设公司首选公司哪家好网页
  • 蓝天使网站建设推广app推广是什么意思