Smartcrop. js: smart image cropping library and smartcrop. js Cropping

Source: Internet
Author: User

Smartcrop. js: smart image cropping library and smartcrop. js Cropping
Smartcrop. js is a JS plug-in that does not cut faces. Today we will introduce you to smartcrop. js, a very good open source library on github recently. 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. Below is a case from its presentation site, please enjoy: 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.