Imagesharp. NET Core cross-platform graphics processing library

Source: Internet
Author: User

Imagesharp is a support for the. NET core cross-platform graphics processing library, Imagesharp is Imageprocessor's. NET core cross-platform implementation.

IMAGESHARP supports the following operations:

resizing, cropping, flipping, rotation, edge detection, etc.

Supports Bmp,png,gif,jpeg encoders.

EXIF reads and writes for JPEG.

Temporarily does not support drawing, that is, can not support verification code and watermark and other operations.

Github:https://github.com/jimbobsquarepants/imagesharp

The current version is 1.0.0-alpha7.

New Project

Create a new. NET Core Console Application.

Add Reference

Because it is still alpha, it is not placed in NuGet and 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

Writing code

First we need a diagram to place it at the root of the program command as Lena.jpg.

The sample code is as follows:

         Public Static voidMain (string[] args) {            //Read EXIF            using(FileStream input = File.openread ("lena.jpg") {image Image=NewImage (input); varEXIF =image.                Exifprofile.values; foreach(varIteminchEXIF) {Console.WriteLine (item. Tag+":"+item.                Value); }            }                        //Zoom            using(FileStream input = File.openread ("lena.jpg"))            using(FileStream output = File.openwrite ("lena2.jpg") {image Image=NewImage (input); Image. Resize (image. Width/2, image. Height/2)                     .            Save (output); }            //cropping            using(FileStream input = File.openread ("lena.jpg"))            using(FileStream output = File.openwrite ("lena3.jpg") {image Image=NewImage (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=NewImage (input); Image. Rotate (rotatetype.rotate180).            Save (output); }            //set the pixel point way to simply draw a blank            using(FileStream output = File.openwrite ("lena5.jpg") {image Image=NewImage (1xx, 2xx); color[] Colors=Newcolor[20000];  for(inti =0; I <20000; i++) {Colors[i]=Color.White; } image. SetPixels ( -, $, colors); Image.            Save (output);        } console.readkey (); }

Run the program in the program root directory to get the following figure

The above is the simple use of imagesharp, and more can be seen on the official GitHub.

If you think this article is helpful to you, please click " recommend ", thank you.

Imagesharp. NET Core cross-platform graphics processing library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.