Javascript Image Processing Library | chobi

chobi is a small pure JavaScript image processing library that allows you to apply artboard canvas -based filters on any images you select.

Supported image filters:

  • Black And White imgObj.blackAndWhite()
  • Sepia imgObj.sepia()
  • Negative imgObj.negative()
  • Vintage imgObj.vintage()
  • Cross ProcessimgObj.crossProcess()
  • Brightness imgObj.brightness(amount)
  • Contrast imgObj.contrast(amount)
  • Crop imgObj.crop(xCord,yCord,width,height)
  • Noise effect imgObj.noise()
  • Crayon effect imgObj.crayon()
  • Cartoonify imgObj.cartoon()
  • Vignette imgObj.vignette(amount)
  • Resize imgObj.resize(width,height)
  • Watermark imgObj.watermark(imgElem,amount,x,y,width,height,callback)
  • Method chaining is also possible imgObj.brightness(-5).sepia().negative().loadImageToCanvas()

To load the Image to a canvas – Call the loadImageToCanvas() method on the Chobi object

To get an Image Element From the Chobi Object – Call the getImage() method on the Chobi object

To get the Image Data, like width, height, and pixel information – Call the extractImageData() method on the Chobi object

To download the Chobi object as an image – Call the download(filename,filetype) method on the Chobi object

To make your own filter you may use the following methods

  • imgObj.getColorAt(x,y) to get the r,g,b, values at the x,y coordinate
  • imgObj.setColorAt(x,y,colorObj) to set the Color at the x,y coordinate with colorObj. ColorObj has the following format {red: redValue, green: greenValue, blue: blueValue, alpha: alphaValue}
  • imgObj.imageData.width to get the width of the image
  • imgObj.imageData.height to get the height of the image

Must Read: (base64) Pure JavaScript Image Cropping Functionality To Your Web | js-cropper

How to make use of it:

1. Download the mini version of the chobo library and place it in the document.

<script src="src/Chobi.min.js"></script>

2. Create a new Chobi object and specify the path to your images.

var imgObj = new Chobi(document.getElementById("image-file");
// or
var imgObj = new Chobi("img.jpg");
// or
imgObj = new Chobi(new Image(...));
// or
imgObj = new Chobi(document.getElementById('myimg');

3. Create an HTML5 panel element to place your image.

<canvas width="800" height="500" id="canvas"></canvas>

4. Convert photo or image to canvas.

imgObj.ready(function(){
  this.loadImageToCanvas(document.getElementById("canvas"));
}

5. Apply a filter (or a series of filters) of your choice to the image.

// Black And White 
imgObj.blackAndWhite()
// Sepia 
imgObj.sepia()
// Negative 
imgObj.negative()
// Vintage 
imgObj.vintage()
// Cross 
ProcessimgObj.crossProcess()
// Brightness 
imgObj.brightness(amount)
// Contrast 
imgObj.contrast(amount)
// Crop 
imgObj.crop(xCord,yCord,width,height)
// Noise effect 
imgObj.noise()
// Crayon effect 
imgObj.crayon()
// Cartoonify
imgObj.cartoon()
// Vignette 
imgObj.vignette(amount)
// Filter chaining 
imgObj.brightness(-5).sepia().negative()

6. API Option.

// Black And White 
imgObj.blackAndWhite()
// Sepia 
imgObj.sepia()
// Negative 
imgObj.negative()
// Vintage 
imgObj.vintage()
// Cross 
ProcessimgObj.crossProcess()
// get an Image Element
imgObj.getImage()
// get the Image Data, like width, height and pixel information
imgObj.extractImageData()
// download as an image
imgObj.download(filename,filetype)
// get the r,g,b,a values at the x,y coordinate
imgObj.getColorAt(x,y)
// set the Color at x,y coordinate with colorObj. ColorObj has the following format {red: redValue, green: greenValue, blue: blueValue, alpha: alphaValue}
imgObj.setColorAt(x,y,colorObj)
// get the width of the image
imgObj.imageData.width
// get the height of the image
imgObj.imageData.height

See Also –

Free Pure JavaScript Image Zooming Library | Lightense.js
Simple Javascript Image Viewer Component for Vue 2
Perfect Image Comparison Slider In vanilla javascript | sliderBeforeAfter


See Demo And Download

Official Website(jayankaghosh): Click Here

This superior jQuery/javascript plugin is developed by jayankaghosh. For extra Advanced Usage, please go to the official website.

Related Posts

Google-Translate-Dropdown-Customize-With-Country-Flag

Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Leave a Reply

Your email address will not be published. Required fields are marked *