GithubHelp home page GithubHelp logo

lipsworld / vintagejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rendro/vintagejs

0.0 2.0 0.0 1.79 MB

vintageJS is a jQuery plugin that uses the HTML5 canvas element to add a vintage look to images

Home Page: http://vintagejs.com/

vintagejs's Introduction

#vintageJS# ##Vintage effects for your images with the HTML5 canvas element## vintageJS is a jQuery plugin that uses the html5 canvas element to add a great vintage look to your photos. It comes with three effect-presets and can be customized very easily.

###Requirements### To use vintageJS you need the latest jQuery build from jquery.com, a browser that supports the HTML5 canvas element and the current version of vintageJS from github.

This jQuery-Plugin was tested and worked fine in the following browsers:

  • Mozilla FireFox 3.16.14
  • Google Chrome 9.0.597.107
  • Apple Safari 5.0.3
  • Opera 11.01
  • Internet Explorer 9

###Usage###

You need to load the jQuery Library, the vintageJS Library and the vintageJS stylesheet in the header of your html document:

<script src="src/jquery.js"></script>
<script src="src/vintage.js"></script>
<link rel="stylesheet" type="text/css" href="css/vintagejs.css" media="all" />

The next step is to add an event listener to the images to trigger the vintage-effect. For this example we will use the click event:

<script>
$(function () {
    $('img.vintage').click(function () {
        $(this).vintage();
    });
});
</script>

That's it! Now add images with the class "vintage" to your html and click on them to see the result.

###Options###

You can change the effect by adding options to the vintageJS call. There are three presets that you can use:

  • default: the default preset is used when no preset is given
  • sepia: sepia effect
  • green: green color overlay vintage effect
  • grayscale: turns image into grayscale image
  • custom: Only curves will be adjusted, all the other effects are switched off so that you can build your own vintage look

If you like to change the style to your own settings, here are the full options you can manipulate:

  • vignette: To avoid the vignette effect set this option to false. Otherwise you need to set it to a literal object with "black" and "white" as variables between 0 and 1 to set the strength of the vignette effect. Example: vignette: {black:0.5, white:0.2}
  • noise: How much noise do you want to add to your image.
  • screen: Add a layer with the photoshop like blending mode "screen" to blur out colors. You can define a solid color and the opacity of the layer. Example: screen: { red: 227, green: 12, blue: 169, strength: 0.1 }
  • desaturate: False or value between 0 and 1, which is the percentage how much the image is desaturated
  • allowMultiEffect: If this flag is set to true, you may trigger the effect multiple times. Default value is false.
  • mime: Set the mime type of the returned image. Default is image/jpeg
  • viewFinder: Path to a viewFinder image that will be added to the image to create a ttv-Effect (through the viewfinder). You will find an example image under documentation/img/viewfinder.jpg (Source: Nesster on Flickr)
  • callback: Callback function that is triggered when the base64 string of the new source is written to the DOM

Here is how a custom call could look like:

<script>
$(function () {
    $('img.vintage').click(function () {
        $(this).vintage({
            vignette: {
                black: 0.8,
                white: 0.2
            },
            noise: 20,
            screen: {
                red: 12,
                green: 75,
                blue: 153,
                strength: 0.3
            },
            desaturate: 0.05
        });
    });
});
</script>

vintagejs's People

Contributors

abovethewater avatar

Watchers

James Cloos avatar Carlos Matos 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.