赞
踩
目录
vs2019;
安装最新的SixLabors.ImageSharp
- // Copyright (c) Six Labors and contributors.
- // Licensed under the Apache License, Version 2.0.
-
- //using System.Numerics;
- using SixLabors.ImageSharp; // Image
- //using SixLabors.ImageSharp.PixelFormats;
- using SixLabors.ImageSharp.Processing; // image.Mutate
-
- namespace ResizeImage
- {
- static class Program
- {
- static void Main(string[] args)
- {
- // 创建文件夹
- System.IO.Directory.CreateDirectory("output");
-
- // 读取图片
- using (Image image = Image.Load("fb.jpg"))
- {
- image.Mutate(x => x
- .Resize(image.Width / 2, image.Height / 2) // 缩放
- .Grayscale()); // 转灰度图
-
- image.Save("output/fb.png"); // 保存图片 Automatic encoder selected based on extension.
- }
- }
- }
- }
-------------》
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。