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

@psdk/frame-imageb

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@psdk/frame-imageb - npm Package Compare versions

Comparing version 0.2.67 to 0.3.0

18

build/index.js

@@ -1,17 +0,1 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./process"), exports);
export * from './process';

26

build/process/basic/threshold.js

@@ -1,26 +0,21 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PinedThresholdValue = exports.ThresholdValue = exports.AbstractThreshold = void 0;
const process_1 = require("../process");
const types_1 = require("../../types");
const tools_1 = require("../../tools");
class AbstractThreshold extends process_1.ImagebProcesser {
import { ImagebProcesser } from "../process";
import { ProcessedImage, ProcessedResult, ThresholdValueMode } from "../../types";
import { ImagebTool } from "../../tools";
export class AbstractThreshold extends ImagebProcesser {
constructor(threshold) {
super();
this.mode = types_1.ThresholdValueMode.avg;
this.mode = ThresholdValueMode.avg;
this.threshold = threshold !== null && threshold !== void 0 ? threshold : new PinedThresholdValue();
}
process(input) {
let result = tools_1.ImagebTool.zeroAndOne(input);
return new types_1.ProcessedResult({
let result = ImagebTool.zeroAndOne(input);
return new ProcessedResult({
origin: input,
result: new types_1.ProcessedImage({ data: result, width: result.width, height: result.height })
result: new ProcessedImage({ data: result, width: result.width, height: result.height })
});
}
}
exports.AbstractThreshold = AbstractThreshold;
class ThresholdValue {
export class ThresholdValue {
}
exports.ThresholdValue = ThresholdValue;
class PinedThresholdValue extends ThresholdValue {
export class PinedThresholdValue extends ThresholdValue {
constructor(value) {

@@ -34,2 +29,1 @@ super();

}
exports.PinedThresholdValue = PinedThresholdValue;

@@ -1,8 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GrayscaleImage = void 0;
const process_1 = require("../process");
const types_1 = require("../../types");
const tools_1 = require("../../tools");
class GrayscaleImage extends process_1.ImagebProcesser {
import { ImagebProcesser } from "../process";
import { ProcessedImage, ProcessedResult } from "../../types";
import { ImagebTool } from "../../tools";
export class GrayscaleImage extends ImagebProcesser {
constructor(options) {

@@ -13,7 +10,7 @@ super();

process(input) {
let result = tools_1.ImagebTool.convertGreyImg(input);
let result = ImagebTool.convertGreyImg(input);
if (this._processer == null) {
return new types_1.ProcessedResult({
return new ProcessedResult({
origin: input,
result: new types_1.ProcessedImage({ data: result, width: result.width, height: result.height })
result: new ProcessedImage({ data: result, width: result.width, height: result.height })
});

@@ -24,2 +21,1 @@ }

}
exports.GrayscaleImage = GrayscaleImage;

@@ -1,8 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReverseColorImage = void 0;
const process_1 = require("../process");
const types_1 = require("../../types");
const tools_1 = require("../../tools");
class ReverseColorImage extends process_1.ImagebProcesser {
import { ImagebProcesser } from "../process";
import { ProcessedImage, ProcessedResult } from "../../types";
import { ImagebTool } from "../../tools";
export class ReverseColorImage extends ImagebProcesser {
constructor(options) {

@@ -13,7 +10,7 @@ super();

process(input) {
let result = tools_1.ImagebTool.invertBitmap(input);
let result = ImagebTool.invertBitmap(input);
if (this._processer == null) {
return new types_1.ProcessedResult({
return new ProcessedResult({
origin: input,
result: new types_1.ProcessedImage({ data: result, width: result.width, height: result.height })
result: new ProcessedImage({ data: result, width: result.width, height: result.height })
});

@@ -24,2 +21,1 @@ }

}
exports.ReverseColorImage = ReverseColorImage;

@@ -1,10 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ThresholdImage = void 0;
const threshold_1 = require("../basic/threshold");
class ThresholdImage extends threshold_1.AbstractThreshold {
import { AbstractThreshold, PinedThresholdValue } from "../basic/threshold";
export class ThresholdImage extends AbstractThreshold {
constructor(options) {
super(new threshold_1.PinedThresholdValue(options === null || options === void 0 ? void 0 : options.threshold));
super(new PinedThresholdValue(options === null || options === void 0 ? void 0 : options.threshold));
}
}
exports.ThresholdImage = ThresholdImage;

@@ -1,22 +0,6 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./process"), exports);
__exportStar(require("./impls/gray"), exports);
__exportStar(require("./impls/reverse"), exports);
__exportStar(require("./impls/threshold"), exports);
__exportStar(require("./pbit/pbita"), exports);
__exportStar(require("./basic/threshold"), exports);
export * from './process';
export * from './impls/gray';
export * from './impls/reverse';
export * from './impls/threshold';
export * from './pbit/pbita';
export * from './basic/threshold';
import { ImagebProcesser } from "../process";
import { ProcessedResult } from "../../types";
export declare class Pbita extends ImagebProcesser {
command: string;
threshold: number;

@@ -9,3 +8,2 @@ compress: boolean;

constructor(options: {
command: string;
threshold: number;

@@ -17,6 +15,4 @@ compress?: boolean;

_topbitimg(canvas: HTMLCanvasElement, width: number, height: number): Uint8Array;
_topbitimgRaw(canvas: HTMLCanvasElement, width: number, height: number): Uint8Array;
_topbitimgReverse(originBytes: Uint8Array): Uint8Array;
private fastExtractPixel;
}
//# sourceMappingURL=pbita.d.ts.map

@@ -1,37 +0,10 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pbita = void 0;
const process_1 = require("../process");
const types_1 = require("../../types");
const pako = __importStar(require("pako"));
const gray_1 = require("../impls/gray");
const reverse_1 = require("../impls/reverse");
class Pbita extends process_1.ImagebProcesser {
import { ImagebProcesser } from "../process";
import { ProcessedImage, ProcessedResult } from "../../types";
import * as pako from 'pako';
import { GrayscaleImage } from "../impls/gray";
import { ReverseColorImage } from "../impls/reverse";
export class Pbita extends ImagebProcesser {
constructor(options) {
super();
this.threshold = options.threshold;
this.command = options.command;
this.compress = options.compress;

@@ -43,6 +16,6 @@ this.reverse = options.reverse;

const height = input.height;
const grayScaleImage = new gray_1.GrayscaleImage();
const grayScaleImage = new GrayscaleImage();
const grayResult = grayScaleImage.process(input);
if (grayResult.result == null) {
return new types_1.ProcessedResult({
return new ProcessedResult({
origin: input,

@@ -54,6 +27,6 @@ message: 'Failed to process gray scale: ' + grayResult.message

if (this.reverse) {
const reverseColorImage = new reverse_1.ReverseColorImage();
const reverseColorImage = new ReverseColorImage();
const reverseResult = reverseColorImage.process(grayResult.result.data);
if (reverseResult.result == null) {
return new types_1.ProcessedResult({
return new ProcessedResult({
origin: input,

@@ -70,3 +43,3 @@ message: 'Failed to process reverse: ' + reverseResult.message

if (outputBytes == null) {
return new types_1.ProcessedResult({
return new ProcessedResult({
origin: input,

@@ -77,7 +50,7 @@ message: 'Failed to process bitimg'

if (this.compress) {
outputBytes = pako.deflate(outputBytes, { windowBits: 10 });
outputBytes = pako.deflate(outputBytes);
}
return new types_1.ProcessedResult({
return new ProcessedResult({
origin: input,
result: new types_1.ProcessedImage({
result: new ProcessedImage({
data: preprocessCanvas,

@@ -91,10 +64,2 @@ width: width,

_topbitimg(canvas, width, height) {
if (this.command == 'tspl' && !this.compress) {
return this._topbitimgReverse(this._topbitimgRaw(canvas, width, height));
}
else {
return this._topbitimgRaw(canvas, width, height);
}
}
_topbitimgRaw(canvas, width, height) {
var _a;

@@ -137,12 +102,2 @@ const ctx = canvas.getContext('2d');

}
_topbitimgReverse(originBytes) {
if (originBytes == null) {
return null;
}
const bytes = [];
for (let i = 0; i < originBytes.length; i++) {
bytes[i] = ~originBytes[i];
}
return new Uint8Array(bytes);
}
fastExtractPixel(imageData, x, y, w, h) {

@@ -167,2 +122,1 @@ let i, j;

}
exports.Pbita = Pbita;

@@ -1,6 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImagebProcesser = void 0;
class ImagebProcesser {
export class ImagebProcesser {
}
exports.ImagebProcesser = ImagebProcesser;

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImagebTool = void 0;
class ImagebTool {
export class ImagebTool {
static invertBitmap(canvas) {

@@ -57,2 +54,1 @@ const ctx = canvas.getContext('2d');

}
exports.ImagebTool = ImagebTool;

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ThresholdValueMode = exports.ProcessedImage = exports.ProcessedResult = void 0;
class ProcessedResult {
export class ProcessedResult {
constructor(options) {

@@ -11,4 +8,3 @@ this.origin = options.origin;

}
exports.ProcessedResult = ProcessedResult;
class ProcessedImage {
export class ProcessedImage {
constructor(options) {

@@ -21,4 +17,3 @@ this.data = options.data;

}
exports.ProcessedImage = ProcessedImage;
var ThresholdValueMode;
export var ThresholdValueMode;
(function (ThresholdValueMode) {

@@ -32,2 +27,2 @@ ThresholdValueMode[ThresholdValueMode["sum"] = 0] = "sum";

ThresholdValueMode[ThresholdValueMode["min"] = 6] = "min";
})(ThresholdValueMode = exports.ThresholdValueMode || (exports.ThresholdValueMode = {}));
})(ThresholdValueMode || (ThresholdValueMode = {}));
{
"name": "@psdk/frame-imageb",
"version": "0.2.67",
"version": "0.3.0",
"description": "psdk",

@@ -9,3 +9,3 @@ "main": "build/index.js",

"build": "tsc",
"package": "tsc && ncc build --source-map build/index.js -m -C -o dist && npx webpack",
"package": "tsc && ncc build --source-map build/index.js -m -C -o dist",
"test": "jest",

@@ -19,37 +19,15 @@ "docs": "npx typedoc --out dist/docs index.ts"

"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.17.12",
"@babel/plugin-proposal-decorators": "^7.17.12",
"@babel/plugin-proposal-export-namespace-from": "^7.17.12",
"@babel/plugin-proposal-function-sent": "^7.17.12",
"@babel/plugin-proposal-numeric-separator": "^7.16.7",
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
"@babel/plugin-proposal-throw-expressions": "^7.16.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-transform-modules-commonjs": "^7.18.0",
"@babel/plugin-transform-object-assign": "^7.16.7",
"@babel/plugin-transform-runtime": "^7.18.0",
"@babel/preset-env": "^7.18.0",
"@babel/preset-typescript": "^7.17.12",
"@babel/register": "^7.17.7",
"@babel/runtime-corejs3": "^7.18.0",
"@tarojs/taro": "^3.5.1",
"@types/jest": "^27.5.1",
"@types/node": "^17.0.35",
"@types/uni-app": "^1.4.4",
"@types/wechat-miniprogram": "^3.4.1",
"@vercel/ncc": "^0.33.4",
"babel-loader": "^8.2.5",
"buffer": "^6.0.3",
"canvas": "^2.7.0",
"jest": "^28.1.0",
"string_decoder": "^1.3.0",
"ts-jest": "^28.0.2",
"typedoc": "^0.22.15",
"typescript": "^4.6.4",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2"
"@babel/core": "^7.24.5",
"@babel/preset-env": "^7.24.5",
"@babel/preset-typescript": "^7.24.1",
"@types/jest": "^29.5.12",
"@vercel/ncc": "^0.38.1",
"babel-jest": "^29.7.0",
"canvas": "^2.11.2",
"jest": "^29.7.0",
"typedoc": "^0.25.13",
"typescript": "^5.4.5"
},
"dependencies": {
"pako": "^2.0.4"
"pako": "^2.1.0"
},

@@ -59,3 +37,3 @@ "files": [

],
"gitHead": "1b469612990a3efbf1a3fe4296ed13e8c8865988"
"gitHead": "9796259a6a24ae7e334340f6c28d5ae9b3e45401"
}

Sorry, the diff of this file is not supported yet

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