Smartcrop. js smart image cropping Library _ javascript skills

Source: Internet
Author: User
To test this smart identification plug-in, I tried a lot of wallpaper pictures and intelligently cropped out the main part of the image. Instead, I tried chrome, Firefox, and IE, I found that IE is supported only in versions over 10, chrome and Firefox, and mobile browsers are not. what is black technology ?? Today, let's take a closer look at the smartcrop. js plug-in.

Today, we will introduce you to smartcrop. js, an open source library that is very good on github. It is a smart cropping library for image processing. In many project development scenarios, image uploading may be a user's photo information or product image. However, in the webpage layout, for better user experience, they usually require some width and height constraints. For inappropriate images, users often need to provide a cropping method to better experience the website users. However, the default crop area of an image is usually displayed in a fixed position, which is often not a precise user crop position. Therefore, the open-source library introduced today is designed to solve such problems and provide users with a better user experience.

First, we can use npm install smartcrop or bower install smartcrop to download it. Use it as follows:

SmartCrop. crop (image, {width: 100, height: 100}, function (result) {console. log (result); // {topCrop: {x: 300, y: 200, height: 200, width: 200 }}});

It outputs a better image cropping position, such as {topCrop: {x: 300, y: 200, height: 200, width: 200.

The following is a case of displaying a website:

Github address: https://github.com/jwagner/smartcrop.js

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.