GithubHelp home page GithubHelp logo

felladrin / recrop Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 11 KB

A pure-javascript solution to resize and crop images using HTML5 Canvas.

License: MIT License

JavaScript 71.44% HTML 28.56%
javascript javascript-tools html5-canvas crop-images

recrop's Introduction

Recrop

A simple javascript function to resize and crop images using HTML5 Canvas.

Released under MIT License.

Demo

Check ou the live demo here: http://felladrin.github.io/recrop

Just click on the images to see their original size.

Usage

Call the script inside your html <head> tag:

<script src="recrop.js"></script>

Recrop is now ready to be used. You just need to make the call:

<script>
    recrop("thumb", 120, 80); // Generates thumbnails [Width: 120px] [Height: 80px]
</script>

With the command above, all your images with the class thumb will be thumbnailed:

<img src="http://site.com/img1.jpg" class="thumb"/>
<img src="http://site.com/img2.png" class="thumb"/>
<img src="http://site.com/img3.jpg" class="thumb"/>

Also, you can call it as many times you want, on different classes. For example:

<script>
    recrop("my-other-class", 150, 150);
    recrop("cropped-jpg", 197, 178);
    recrop("picture", 236, 123);
</script>

recrop's People

Contributors

felladrin avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.