Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tiff

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiff - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"name": "tiff",
"version": "1.0.0",
"version": "1.1.0",
"description": "TIFF image decoder written entirely in JavaScript",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -78,3 +78,3 @@ 'use strict';

get maxSampleValue() {
return this.fields.get(281) || (1 << this.bitsPerSample) - 1;
return this.fields.get(281) || Math.pow(2, this.bitsPerSample) - 1;
}

@@ -81,0 +81,0 @@ get xResolution() {

@@ -103,4 +103,5 @@ 'use strict';

const bitDepth = ifd.bitsPerSample;
const sampleFormat = ifd.sampleFormat;
let size = width * height;
const data = getDataArray(size, 1, bitDepth);
const data = getDataArray(size, 1, bitDepth, sampleFormat);

@@ -123,4 +124,6 @@ const compression = ifd.compression;

pixel = fill16bit(data, stripData, pixel, length, this.isLittleEndian());
} else if (bitDepth === 32 && sampleFormat === 3) {
pixel = fillFloat32(data, stripData, pixel, length, this.isLittleEndian());
} else {
unsupported('bitDepth: ', bitDepth);
unsupported('bitDepth', bitDepth);
}

@@ -149,3 +152,3 @@ }

function getDataArray(size, channels, bitDepth) {
function getDataArray(size, channels, bitDepth, sampleFormat) {
if (bitDepth === 8) {

@@ -155,4 +158,6 @@ return new Uint8Array(size * channels);

return new Uint16Array(size * channels);
} else if (bitDepth === 32 && sampleFormat === 3) {
return new Float32Array(size * channels);
} else {
unsupported('bit depth', bitDepth);
unsupported('bit depth / sample format', bitDepth + ' / ' + sampleFormat);
}

@@ -175,4 +180,11 @@ }

function fillFloat32(dataTo, dataFrom, index, length, littleEndian) {
for (var i = 0; i < length * 4; i += 4) {
dataTo[index++] = dataFrom.getFloat32(i, littleEndian);
}
return index;
}
function unsupported(type, value) {
throw new Error('Unsupported ' + type + ': ' + value);
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc