In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you. NET Core cross-platform graphics processing library ImageSharp how to analyze, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article, I hope you can get something.
ImageSharp is a cross-platform graphics processing library that supports .NET Core, and ImageSharp is a cross-platform implementation of ImageProcessor. NET Core.
ImageSharp supports the following operations:
Resize, crop, flip, rotate, edge detection, etc.
Support for BMP,PNG,GIF,JPEG encoders.
EXIF reads and writes for JPEG.
Drawing is not supported yet, that is, operations such as CAPTCHA and watermarking are not supported.
GitHub: https://github.com/JimBobSquarePants/ImageSharp
The current version is 1.0.0-alpha7.
New project
Create a new .NET Core console application.
Add referenc
Since it is still an alpha version, it has not been placed in NuGet, it is https://www.myget.org/gallery/imagesharp on MyGet.
Add the ImageSharp source to the NuGet package source.
ImageSharp source address: https://www.myget.org/F/imagesharp
Then execute the command in the NuGet console:
Install-Package ImageSharp-Version 1.0.0-alpha7
Write code
First of all, we need a picture and place it in the root directory of the program. The command is lena.jpg.
The sample code is as follows:
Public static void Main (string [] args) {
/ / read EXIFusing (FileStream input = File.OpenRead ("lena.jpg")) {Image image = new Image (input); var exif = image.ExifProfile.Values; foreach (var item in exif) {Console.WriteLine (item.Tag+ ":" + item.Value) }} / / Zoom using (FileStream input = File.OpenRead ("lena.jpg")) using (FileStream output = File.OpenWrite ("lena2.jpg")) {Image image = new Image (input) Image.Resize (image.Width / 2, image.Height / 2) .Save (output);} / / crop using (FileStream input = File.OpenRead ("lena.jpg"))
Using (FileStream output = File.OpenWrite ("lena3.jpg")) {Image image = new Image (input); image.Crop (image.Width / 2, image.Height / 2) .Save (output);} / / rotate 180 °using (FileStream input = File.OpenRead ("lena.jpg"))
Using (FileStream output = File.OpenWrite ("lena4.jpg")) {Image image = new Image (input); image.Rotate (RotateType.Rotate180) .Save (output) } / / simply draw blank using (FileStream output = File.OpenWrite ("lena5.jpg")) {Image image = new Image (100200); Color [] colors = new Color [20000]; for (int I = 0; I < 20000) Colors +) {colors [I] = Color.White;} image.SetPixels (100,200, colors); image.Save (output);} Console.ReadKey ();}
Running the program will get the following figure in the root directory of the program
The above is how to analyze the .NET Core cross-platform graphics processing library ImageSharp. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.