1.0.1 • Published 3 years ago

test-image-processing v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Image processing library

This library was developed with javascript and works for client-side browser.

Installation

Install the library using with npm

  npm install test-image-processing

Usage/Examples

Create a html file and call the bundle

<head>
    <script src='./node_modules/test-image-processing/index.js'></script>
</head>

Create a div into the body whenever you want to use it

<div id="div-canvas">

</div>

Functions Reference

Load image to process

<body>
    <script>
        var upload = new jsimage.image(div_id,pathImage,canvasId);
        upload.uploadImage();
    </script>
</body>
ParameterTypeDescription
divIdstringRequired. div id where the canvas will be embebed
pathImagestringRequired. path where the image is located
canvasIdstringNot Required. the id name for the canvas

Transform image to grayscale

<body>
    <script>
        var grayscale = new jsimage.image(div_id,pathImage,canvasId);
        grayscale.grayScaleImage();
    </script>
</body>
ParameterTypeDescription
divIdstringRequired. div id where the canvas will be embebed
pathImagestringRequired. path where the image is located
canvasIdstringNot Required. the id name for the canvas

Rotate image according to the given degrees

<body>
    <script>
        var rotate = new jsimage.image(divId,pathImage,canvasId,degrees);
        rotate.rotateImage();
    </script>
</body>
ParameterTypeDescription
divIdstringRequired. div id where the canvas will be embebed
pathImagestringRequired. path where the image is located
canvasIdstringNot Required. the id name for the canvas
degreesnumberRequired. value to rotate the image

Resize the image according to percentage

<body>
    <script>
        var resize = new jsimage.image(divId,pathImage,canvasId,percentage);
        resize.resizeImage();
    </script>
</body>
ParameterTypeDescription
divIdstringRequired. div id where the canvas will be embebed
pathImagestringRequired. path where the image is located
canvasIdstringNot Required. the id name for the canvas
percentagenumberRequired. value to rotate the image

Reset image to original state

<body>
    <script>
        var original = new jsimage.image(divId,pathImage,canvasId);
        original.setOriginal();
    </script>
<body>
ParameterTypeDescription
divIdstringRequired. div id where the canvas will be embebed
pathImagestringRequired. path where the image is located
canvasIdstringNot Required. the id name for the canvas

Run the sample

Use a web server to run: sample/index.html