decode-tiff
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "decode-tiff", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Lightweight tiff decoder", | ||
"main": "index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "ava", | ||
"build": "webpack --config example/browser/webpack.config.js", | ||
"deploy": "npm run build && gh-pages -d example/browser" | ||
"build:node": "mkdirp lib; babel src/index.js > lib/index.js", | ||
"build:browser": "mkdirp dist; browserify -t [ babelify ] src/browser.js | uglifyjs --compress --mangle > dist/decode-tiff.min.js", | ||
"build:example": "cp dist/decode-tiff.min.js example/browser", | ||
"deploy": "npm run build:example && gh-pages -d example/browser", | ||
"prepublish": "npm run build:node && npm run build:browser" | ||
}, | ||
@@ -24,7 +27,12 @@ "repository": { | ||
"ava": "^0.21.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babelify": "^7.3.0", | ||
"browserify": "^14.4.0", | ||
"gh-pages": "^1.0.0", | ||
"glob": "^7.1.2", | ||
"mkdirp": "^0.5.1", | ||
"pngjs": "^3.2.0", | ||
"rimraf": "^2.6.1", | ||
"webpack": "^3.0.0" | ||
"uglify-js": "^3.0.25" | ||
}, | ||
@@ -31,0 +39,0 @@ "ava": { |
@@ -8,3 +8,3 @@ # decode-tiff | ||
## How to use it | ||
### Node.js | ||
### With Node.js | ||
@@ -30,27 +30,38 @@ ```sh | ||
### Browser | ||
### With Browser | ||
This example show metadata of the dropped file. [Working demonstration is here.](https://quramy.github.io/decode-tiff/) | ||
Download script file from [dist/decode-tiff.min.js](https://raw.githubusercontent.com/Quramy/decode-tiff/master/dist/decode-tiff.min.js). Alternatively you can use Module Bundler, such as webpack, Browserify, and Rollup. | ||
```js | ||
const { decode } = require("decode-tiff"); | ||
This example shows metadata of the dropped file. [Working demonstration is here.](https://quramy.github.io/decode-tiff/) | ||
```html | ||
<html> | ||
<head></head> | ||
<body> | ||
<div id="drop"> | ||
<p>Drop TIFF file here!</p> | ||
</div> | ||
<script src="decode-tiff.min.js"></script> | ||
<script> | ||
const { decode } = window.decodeTiff; | ||
const elm = document.getElementById("drop"); | ||
elm.addEventListener("dragenter", e => e.preventDefault()); | ||
elm.addEventListener("dragover", e => e.preventDefault()); | ||
elm.addEventListener("drop", (e) => { | ||
elm.addEventListener("drop", e => { | ||
e.preventDefault(); | ||
const file = e.dataTransfer.files[0]; | ||
const reader = new FileReader(); | ||
reader.addEventListener("load", (e) => { | ||
reader.addEventListener("load", e => { | ||
const arrayBuffer = e.target.result; | ||
const { width, height, ifdEntries } = decode(arrayBuffer); | ||
const IFDs = JSON.stringify({ width, height, ifdEntries }, null, 2); | ||
elm.innerHTML = ` | ||
<pre>${IFDs}</pre> | ||
`; | ||
const metadata = JSON.stringify({ width, height, ifdEntries }, null, 2); | ||
elm.innerHTML = `<pre>${metadata}</pre>`; | ||
}); | ||
reader.readAsArrayBuffer(file); | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
``` | ||
@@ -80,3 +91,4 @@ | ||
- [x] 8bit Gray scale | ||
- [ ] Color Pallet | ||
- [x] 4bit Gray scale | ||
- [ ] Palette-Color | ||
- [ ] Bilevel(white) | ||
@@ -86,6 +98,10 @@ - [ ] Bilevel(black) | ||
- [x] No Compression | ||
- [ ] CCITT Group 3 | ||
- [ ] LZW Compression | ||
- [ ] ZIP | ||
- [ ] Packbits | ||
- Masking | ||
- [ ] Transparency Mask | ||
## License | ||
MIT. See LICENSE.txt. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1354944
9
301
104
11
1