Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

img-reduce-size-js

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

img-reduce-size-js

Reduce image using js

latest
Source
npmnpm
Version
1.4.0
Version published
Weekly downloads
16
6.67%
Maintainers
1
Weekly downloads
 
Created
Source

img-resize-js

image resize using js. reduce image size and ready to upload. image resize and return BLOB can be converted into Base64

NPM

Installation

npm install --save img-reduce-size-js

Also available to install globally:

npm install --global img-reduce-size-js

Usage

To include img-reduce-size-js on your website or npm application, use any of the following methods.

ES5

const { imageResize } =  require("img-reduce-size-js");

ES6

import { imageResize } from "img-reduce-size-js"
    imageResize({
        file: e.target.files[0],
        maxSize: 500
        }).then(function (resizedImage) {
            console.log("upload resized image", resizedImage)
        }).catch(function (err) {
            console.error(err);
        });

FOR BASE64

        imageResize({
            file: e.target.files[0],
            maxSize: 500
            }).then(function (blob) {
            var reader = new FileReader();
            reader.readAsDataURL(blob);
            reader.onloadend = function () {
                var base64data = reader.result;
                console.log(base64data);
            }
            }).catch(function (err) {
            console.error(err);
            });

License

Apache-2.0. Copyright (c) Arsalan Akhtar, Inc.

Keywords

Resize

FAQs

Package last updated on 14 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts