Jcrop - The Javascript Image Cropping Engine

Overview

Jcrop Image Cropping Plugin

Jcrop is the quick and easy way to add image cropping functionality to your web application. It combines the ease-of-use of a typical jQuery plugin with a powerful cross-platform DHTML cropping engine that is faithful to familiar desktop graphics applications.

Cross-platform Compatibility

  • Firefox 2+
  • Safari 3+
  • Opera 9.5+
  • Google Chrome 0.2+
  • Internet Explorer 6+

Feature Overview

  • Attaches unobtrusively to any image
  • Supports aspect ratio locking
  • Supports minSize/maxSize setting
  • Callbacks for selection done, or while moving
  • Keyboard support for nudging selection
  • API features to create interactivity, including animation
  • Support for CSS styling
  • Experimental touch-screen support (iOS, Android, etc)

Contributors

Special thanks to the following contributors:

  • Bruno Agutoli
  • dhorrigan
  • Phil-B
  • jaymecd
  • all others who have committed their time and effort to help improve Jcrop

MIT License

Jcrop is free software under MIT License.

Copyright (c) 2008-2018 Tapmodo Interactive LLC,
http://github.com/tapmodo/Jcrop

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • When attempting to crop image that is below the fold, jcrop jumps down the page.

    When attempting to crop image that is below the fold, jcrop jumps down the page.

    The issue can be seen here: http://www.chicengine.com/pinterest/

    To recreate the error:

    1. Scroll halfway down the page.
    2. Click on an image.
    3. Try to drag crop area.
    4. You will see that you are "jumped" further down the page.
    opened by jrosebr1 17
  • [enhancement] Add missing bower.json.

    [enhancement] Add missing bower.json.

    Hey, maintainer(s) of tapmodo/Jcrop!

    We at VersionEye are working hard to keep up the quality of the bower's registry.

    We just finished our initial analysis of the quality of the Bower.io registry:

    7530 - registered packages, 224 of them doesnt exists anymore;

    We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

    Sadly, your library tapmodo/Jcrop is one of them.

    Can you spare 15 minutes to help us to make Bower better?

    Just add a new file bower.json and change attributes.

    {
      "name": "tapmodo/Jcrop",
      "version": "1.0.0",
      "main": "path/to/main.css",
      "description": "please add it",
      "license": "Eclipse",
      "ignore": [
        ".jshintrc",
        "**/*.txt"
      ],
      "dependencies": {
        "<dependency_name>": "<semantic_version>",
        "<dependency_name>": "<Local_folder>",
        "<dependency_name>": "<package>"
      },
      "devDependencies": {
        "<test-framework-name>": "<version>"
      }
    }
    
    

    Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

    NB! Please validate your bower.json with jsonlint before commiting your updates.

    Thank you!

    Timo, twitter: @versioneye email: [email protected] VersionEye - no more legacy software!

    opened by timgluz 15
  • Is there a way for a cropped area to be always selected?

    Is there a way for a cropped area to be always selected?

    I need to block users for clicking to the area, that is not in the crop. It sometimes confuses them, when they click to the black area and the crop disappears.

    opened by jesteracer 15
  • Set max-width to none for all images in jcrop-holder

    Set max-width to none for all images in jcrop-holder

    Fixes issues when combining Jcrop with responsive grids like e.g. Zurb Foundation.

    Took a while to debug this, but Zurb Foundation's grid.css sets max-width to 100% for all images which completely breaks Jcrop (see screenshot below). Simply setting max-width to none for all images within the jcrop-holder fixes the issue.

    Screenshot

    opened by bmaland 9
  •  Invalid regular expression: /(^|\.)jcrop(\.|$)/: Stack overflow

    Invalid regular expression: /(^|\.)jcrop(\.|$)/: Stack overflow

    i get these errors: in chrome Uncaught SyntaxError: Invalid regular expression: /(^|.)jcrop(.|$)/: Stack overflow in safari: jquery.js:1751 RangeError: Maximum call stack size exceeded.

    i just updated to 0.9.12 jcrop and 1.9.1 jquery

    does anyone know what could be wrong or what to check. thank you.

    opened by vitulicny 7
  • Is there any way to optimise for mobile?

    Is there any way to optimise for mobile?

    Is there any way to optimise for mobile? It works .. bad. I mean "slow" and "stucks touches all over the page". Well, the "stucks touches all over the page" i'll try to fix (not sure, but may be bootstrap bug), but "slow" is native.

    opened by sadfuzzy 7
  • Radio button add on the left of my image

    Radio button add on the left of my image

    When I use Jrop, a radio button is add on the left of my image I've dig a little and find out that it's because of KeyManager. In fact, it create a radio input which seem useful for moving the crop selection with the keyboard.

    To hide it, I've change this:

            position: 'fixed',
            left: '-12000px',
            width: '12px'
          }),
    
    

    by this :

            position: 'fixed',
            left: '-12000px',
            width: '12px'
          }),
    

    Since I don't really understand why this input is here, I don't know if this fix is a good one.

    Hope somebody will enlighten me about it and fix this properly.

    opened by nicolasbadia 7
  • Are multiple selection on the same image possible?

    Are multiple selection on the same image possible?

    Goal:

    • make multiple selections on the same image
    • 2nd selection doesn't cancel 1st selection (both are visible at the same time)

    Additional:

    • concatenate multiple selections in on square polygon

    Or is it better to make multiple instances of jCrop? (but how are they then stacked, they are supposed to be on the same level, not one on top of the other)

    opened by ph0b0s 6
  • double-click/tap to crop

    double-click/tap to crop

    Please support for a double-click/tap event handler on the cropped area (not the rest of the image) which could then be hooked into to execute the crop/etc.

    opened by MarcusJT 6
  • Right-click behavior

    Right-click behavior

    When right-clicking on a JCrop-targeted image I don't see the usual "save image as" browser menu. There does not seem to be a way to make JCrop not mess with the right-click on image behavior (at least there is no such mention in the docs).

    opened by npat-efault 5
  • Rounding issue causes blurry image in PHP

    Rounding issue causes blurry image in PHP

    I use jCrop to resize website screenshot down to a desired size. I need end result of 740x656.

    So I set aspect ratio to 740/656 - the user isn't allowed to make a selection smaller than that.

    If the user sets jCrop selection to 940 width, jCrop calculates a height of 833. But in actuality, the correct dimension should be 940 x 833.297297297297...

    So when I pass these coordinates to PHP, the resized image at 740x656 comes back very blurry. Because PHP creates image that is 740x656 from the 940x833 selection.

    I have spent some 6 hours or so investigation this issue so far. I'm under the impression the issue is with jCrop allowing the user to make selection that should not be allowed. The aspect ratio isn't correct on the user's selection:

    740/656 = 1.1280 48780 48780 48780 48780...

    940/833 = 1.1284513805522208883553421368547

    940*656/740 = 833.297 297 297 297 297 297 297...

    Any ideas how I can solve this problem? I need the resulting image to be clear.

    opened by mpiasta-ca 4
  • Broken example on jcrop.com due to wrong event name

    Broken example on jcrop.com due to wrong event name

    This isn't exactly a code issue in JCrop, but rather on its website. I've submitted the issue there due to a lack of a better place.
    I'll get straight to the point:

    See the last example on https://jcrop.com/guide/#reading-state "crop.move" isn't an event and causes the code to do nothing. Change it to "crop.change" in order to fix it.

    opened by asdfMaciej 0
  • Is this project maintained?

    Is this project maintained?

    The last commit was September 2018 and it looks like quite a few github issues here, and incomplete documentation. Just wondering what the future is for Jcrop.

    opened by gRegorLove 0
  • trueSize or min, maxsize not working for large image

    trueSize or min, maxsize not working for large image

    Hi I am trying to fix my image cropping area like 500x500 or any desire, but it is not possible with trueSize or minSize or maxSize, I have huge large images like 1600x2000 which covers all the browser area so I need a resize method.

       `Jcrop.load('target').then(img => {
            jcp = Jcrop.attach(img, { multi: true });
            jcp.setOptions({
                minSize: [250, 250],
                maxSize: [250, 350]
            });
          
        });`
    
    opened by Utsaww 0
  • Update guide to use correct method

    Update guide to use correct method

    Currently the guide shows an example that calls newCropper() on a Jcrop instance. This does not actually work because, as far as I can tell, this method does not exist. Additionally, the header above already shows the working method, newWidget(). Hopefully this change will save someone else some time and prevent them from banging their head against a wall for no reason 😄.

    opened by CalebBassham 0
  • jcrop.newCropper is not a function

    jcrop.newCropper is not a function

    In these examples:

    https://jcrop.com/guide/widgets.html#creating-a-widget https://jcrop.com/guide/instance.html#newwidget-rect-options

    const jcrop = Jcrop.attach('target');
    const rect = Jcrop.Rect.fromPoints([100,100],[200,200]);
    jcrop.newCropper(rect,{ aspectRatio: rect.aspect });
    

    TypeError: jcrop.newCropper is not a function

    I'm finding it really hard to get this working, and unfortunately the documentation is very confusing or incomplete. (eventually got this figured out)

    Would be nice if the page at: https://jcrop.com/examples/ could have an example source code that I could copy from, as it seems to do exactly what I want.

    I'm simply looking to put a default cropper active, centered to the image, with fixed aspect ratio.

    opened by nunoperalta 2
Owner
Kelly Hallman
Kelly Hallman
Content aware image cropping

smartcrop.js Smartcrop.js implements an algorithm to find good crops for images. It can be used in the browser, in node or via a CLI. Image: https://w

Jonas Wagner 12.5k Jan 4, 2023
Simple Cropper is a jQuery plugin which gives you ability to add cropping functionality to your web application

Simple Cropper is a jQuery plugin which gives you ability to add cropping functionality to your web application. It uses html5 canvas to create cropped images and css3, so it only works on latest browsers.

null 1 Feb 15, 2022
optimize image & upload file to cloud as image bed with tiny image automic.

Rush! 图片压缩 & 直传图床工具 这是一个兴趣使然的项目, 希望 Rush! 能让这个世界的网络资源浪费减少一点点 下载 Downloads 获取最新发行版 功能 Features 拖拽批量压缩图片, 支持格式 jpg/png/gif Drop to optimize, jpg/png/gif

{ Chao } 3 Nov 12, 2022
The project integrates workflow engine, report engine and organization authority management background, which can be applied to the development of OA, HR, CRM, PM and other systems. With tlv8 IDE, business system development, testing and deployment can be realized quickly.

介绍 项目集成了工作流引擎、报表引擎和组织机构权限管理后台,可以应用于OA、HR、CRM、PM等系统开发。配合使用tlv8 ide可以快速实现业务系统开发、测试、部署。 后台采用Spring MVC架构简单方便,前端使用流行的layui界面美观大方。 采用组件开发技术,提高系统的灵活性和可扩展性;采

Qian Chen 38 Dec 27, 2022
A Javascript library that discourages and prevents image theft/download by preventing client ability to retrieve the image.

ProtectImage.js ProtectImage.js is a Javascript library that helps prevent image theft by disabling traditional user interactions to download/copy ima

null 4 Aug 18, 2022
Simple JavaScript Library to add parallax image to background-image

Backpax Simple JavaScript Library to add parallax image to background-image Install $ npm install backpax --save Demo Demo page is here Usage If you

appleple 13 Oct 12, 2022
🖼️ Image proxy for Next.js. Makes it possible to use dynamic domains in next/image component.

Next.js Image Proxy Image proxy for Next.js. Makes it possible to use dynamic domains in next/image component. ❔ Motivation This library makes it poss

Blazity 30 Dec 1, 2022
Piccloud is a full-stack (Angular & Spring Boot) online image clipboard that lets you share images over the internet by generating a unique URL. Others can access the image via this URL.

Piccloud Piccloud is a full-stack application built with Angular & Spring Boot. It is an online image clipboard that lets you share images over the in

Olayinka Atobiloye 3 Dec 15, 2022
Hashmat Noorani 4 Mar 21, 2023
Tiny and powerful JavaScript full-text search engine for browser and Node

MiniSearch MiniSearch is a tiny but powerful in-memory fulltext search engine written in JavaScript. It is respectful of resources, and it can comfort

Luca Ongaro 2k Jan 3, 2023
Javascript engine to make fast games.

G3 Javascript Basic javascript engine to make fast games and write clean code. ??️ Example code: const g3 = new G3() const Window = g3.createWindow("

Starship Code 2 Feb 13, 2022
Minimal template engine with compiled output for JavaScript.

@fnando/seagull Minimal template engine with compiled output for JavaScript. Installation This package is available as a NPM package. To install it, u

Nando Vieira 5 Mar 1, 2022
Lightweight JavaScript (ES6) tweening engine

Lightweight JavaScript (ES6) tweening library. EXAMPLES Examples collection DOCUMENTATION Purpose Install With npm Or fetch from CDN Basic usage Modul

Alexander Buzin 705 Dec 25, 2022
cptcity for the Google Earth Engine JavaScript API (Code Editor)

cptcity for the Google Earth Engine JavaScript API (Code Editor) ?? Table of contents What is Google Earth Engine ? What is cptcity and why ? Top of t

Antony Barja 17 Aug 2, 2022
An ASCII (technically PETSCII :)) "Game Engine" for JavaScript

Announcement! I'm putting this project on hold, because I remembered how much I hate JavaScript. (Please don't take offense, it's just my preference.)

eboatwright 16 Nov 12, 2022
The 2D Game Engine written on JavaScript.

CherryEngine The 2D Game Engine written in JavaScript. NEW UPDATE Version 1.2 Added: TypeObjectError.js Changed: static methods are not static now, yo

> sazix 4 Oct 26, 2022
Tempo is an easy, intuitive JavaScript rendering engine that enables you to craft data templates in pure HTML.

Tempo 2.0 Tempo is an easy, intuitive JavaScript rendering engine that enables you to craft data templates in pure HTML. Why use Tempo? Clear separati

Twigkit 707 Jan 3, 2023
A Lightweight JavaScript Template Engine.

Juicer 中文文档 当前最新版本: 0.6.14 Juicer 是一个高效、轻量的前端 (Javascript) 模板引擎,使用 Juicer 可以是你的代码实现数据和视图模型的分离(MVC)。除此之外,它还可以在 Node.js 环境中运行。 你可以在遵守 MIT Licence 的前提下随意

GuoKai 913 Nov 4, 2022