javascript 用于桌面和触摸设备的图像裁剪库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21896485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 21:55:54  来源:igfitidea点击:

Image Crop Library for desktop and touch devices

javascriptjqueryimagemobile

提问by Joel Lord

I need to find a javascript library for cropping and resizing images that works on both desktop and mobile (touch) devices. It could be a jQuery plugin although I prefer having something that is more vanilla.

我需要找到一个 javascript 库来裁剪和调整适用于桌面和移动(触摸)设备的图像。它可能是一个 jQuery 插件,虽然我更喜欢拥有更普通的东西。

I have searched around and found various options but they all seem to be working for desktop only.

我四处搜索并找到了各种选项,但它们似乎都只适用于桌面。

The project I am currently working on needs the libraries to be MIT and/or GPL licensed.

我目前从事的项目需要获得 MIT 和/或 GPL 许可的库。

I have found this library named jQuery Image Crop (http://codecanyon.net/item/image-crop/5348464) which does exactly what I need but is not distributed under a MIT/GPL license.

我发现了这个名为 jQuery Image Crop ( http://codecanyon.net/item/image-crop/5348464) 的库,它完全符合我的需要,但不是在 MIT/GPL 许可下分发的。

Does anyone have an alternative/suggestion for me ?

有人对我有替代方案/建议吗?

Thanks

谢谢

采纳答案by Abhishek

Try with Jcrop. I'm using it for my project; works fine on mobile. Here is the link: https://jcrop.com/

尝试使用 Jcrop。我在我的项目中使用它;在手机上工作正常。这是链接:https: //jcrop.com/

P.S. Click herefor the old version of the plugin.

PS单击此处获取插件的旧版本。

回答by chrisweb

The library I prefer by far for everything related to cropping is cropper.js

到目前为止,我更喜欢与裁剪相关的所有内容的库是cropper.js

This javascript library has tons of features, is very customizable and has a lot of activity on github:

这个 javascript 库有很多功能,非常可定制,并且在 github 上有很多活动:

https://fengyuanchen.github.io/cropperjs/

https://fengyuanchen.github.io/cropperjs/

回答by Abhishek

I've been searching too and found DarkroomJS. It's under MIT license. It does Crop, rotation, History and Save. Vanilla JS and based on FabricJS handling images in HTML5 canvas.

我也一直在搜索并找到了 DarkroomJS。它在 MIT 许可下。它可以进行裁剪、旋转、历史记录和保存。Vanilla JS 和基于 FabricJS 的处理 HTML5 画布中的图像。

I'm probably going with this to handle user profile pics.

我可能会用它来处理用户个人资料图片。

http://mattketmo.github.io/darkroomjs/

http://mattketmo.github.io/darkroomjs/