0.1.13 • Published 4 years ago

image-worker v0.1.13

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

image-worker

description

Quickly get the dimensions and base64 url of an image file without blocking the UI (additional features coming later).

installation

recommended

npm install --save-dev image-worker

old school

<script type="text/javascript" src="dist/image-processor-worker.js"></script>
var processor = new ImageProcessor(file);

usage

tl/dr

var IP = require('image-processor-worker');
var ip = new IP(file) //javascript File object;
ip.getDetails({preview: true}).then(function(details){
    console.log(details);
})

will yield the following JSON object

{
    width: 100,
    height: 100,
    preview: 'data:image/jpeg;base64,/dg06HthpF...'
}

longer example

Assuming you have the following HTML

<input id="file" type="file" />

and javascript:

var ImageProcessor = require('image-processor-worker');
var field = document.getElementById('file');
field.addEventListener('change', function(e){
    var file = e.target.files[0];
    var processor = new ImageProcessor(file);
    processor.getDetails().then(function(result){
        console.log(result);
    });
})

you'll get the following output:

{
    width: 100,
    height: 100,
    preview: 'data:image/jpeg;base64,/dg06HthpF...'
}
0.1.13

4 years ago

0.1.11

5 years ago

0.1.12

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

6 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago