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

jpeg-js

Package Overview
Dependencies
Maintainers
6
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpeg-js - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

.github/workflows/ci.yml

2

index.d.ts

@@ -13,3 +13,3 @@ export interface RawImageData<T> {

export declare function encode(imgData: RawImageData<BufferLike>, quality?: number): BufferRet;
export declare function encode(imgData: RawImageData<BufferLike> & {comments?: string[]}, quality?: number): BufferRet

@@ -16,0 +16,0 @@ export declare function decode(

@@ -579,3 +579,5 @@ /* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /

function prepareComponents(frame) {
var maxH = 0, maxV = 0;
// According to the JPEG standard, the sampling factor must be between 1 and 4
// See https://github.com/libjpeg-turbo/libjpeg-turbo/blob/9abeff46d87bd201a952e276f3e4339556a403a3/libjpeg.txt#L1138-L1146
var maxH = 1, maxV = 1;
var component, componentId;

@@ -749,2 +751,7 @@ for (componentId in frame.components) {

var qId = data[offset + 2];
if ( h <= 0 || v <= 0 ) {
throw new Error('Invalid sampling factor, expected values above 0');
}
frame.componentsOrder.push(componentId);

@@ -1128,9 +1135,15 @@ frame.components[componentId] = {

}
} catch (err){
if (err instanceof RangeError){
} catch (err) {
if (err instanceof RangeError) {
throw new Error("Could not allocate enough memory for the image. " +
"Required: " + bytesNeeded);
} else {
throw err;
}
if (err instanceof ReferenceError) {
if (err.message === "Buffer is not defined") {
throw new Error("Buffer is not globally defined in this environment. " +
"Consider setting useTArray to true");
}
}
throw err;
}

@@ -1137,0 +1150,0 @@

@@ -538,2 +538,16 @@ /*

}
function writeCOM(comments)
{
if (typeof comments === "undefined" || comments.constructor !== Array) return;
comments.forEach(e => {
if (typeof e !== "string") return;
writeWord(0xFFFE); // marker
var l = e.length;
writeWord(l + 2); // length itself as well
var i;
for (i = 0; i < l; i++)
writeByte(e.charCodeAt(i));
});
}

@@ -629,2 +643,3 @@ function writeSOS()

writeAPP0();
writeCOM(image.comments);
writeAPP1(image.exifBuffer);

@@ -787,3 +802,3 @@ writeDQT();

width: imgData.width,
height: imgData.height
height: imgData.height,
};

@@ -790,0 +805,0 @@ }

{
"name": "jpeg-js",
"version": "0.4.3",
"version": "0.4.4",
"description": "A pure javascript JPEG encoder and decoder",

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

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