@napi-rs/image 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +29 -25
- package/package.json +15 -15
package/index.d.ts
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
export interface AvifConfig {
|
|
7
7
|
/** 0-100 scale, 100 is lossless */
|
|
8
|
-
quality?: number
|
|
8
|
+
quality?: number
|
|
9
9
|
/** 0-100 scale */
|
|
10
|
-
alphaQuality?: number
|
|
10
|
+
alphaQuality?: number
|
|
11
11
|
/** rav1e preset 1 (slow) 10 (fast but crappy), default is 4 */
|
|
12
|
-
speed?: number
|
|
12
|
+
speed?: number
|
|
13
13
|
/** How many threads should be used (0 = match core count) */
|
|
14
|
-
threads?: number
|
|
14
|
+
threads?: number
|
|
15
15
|
/** set to '4:2:0' to use chroma subsampling, default '4:4:4' */
|
|
16
|
-
chromaSubsampling?: ChromaSubsampling
|
|
16
|
+
chromaSubsampling?: ChromaSubsampling
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* https://en.wikipedia.org/wiki/Chroma_subsampling#Types_of_sampling_and_subsampling
|
|
@@ -59,12 +59,12 @@ export const enum ChromaSubsampling {
|
|
|
59
59
|
}
|
|
60
60
|
export interface JpegCompressOptions {
|
|
61
61
|
/** Output quality, default is 100 (lossless) */
|
|
62
|
-
quality?: number
|
|
62
|
+
quality?: number
|
|
63
63
|
/**
|
|
64
64
|
* If true, it will use MozJPEG’s scan optimization. Makes progressive image files smaller.
|
|
65
65
|
* Default is `true`
|
|
66
66
|
*/
|
|
67
|
-
optimizeScans?: boolean
|
|
67
|
+
optimizeScans?: boolean
|
|
68
68
|
}
|
|
69
69
|
export function compressJpegSync(input: Buffer, options?: JpegCompressOptions | undefined | null): Buffer
|
|
70
70
|
export function compressJpeg(input: Buffer, options?: JpegCompressOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<Buffer>
|
|
@@ -102,72 +102,72 @@ export const enum FilterType {
|
|
|
102
102
|
}
|
|
103
103
|
export interface PngEncodeOptions {
|
|
104
104
|
/** Default is `CompressionType::Default` */
|
|
105
|
-
compressionType?: CompressionType
|
|
105
|
+
compressionType?: CompressionType
|
|
106
106
|
/** Default is `FilterType::NoFilter` */
|
|
107
|
-
filterType?: FilterType
|
|
107
|
+
filterType?: FilterType
|
|
108
108
|
}
|
|
109
109
|
export interface PNGLosslessOptions {
|
|
110
110
|
/**
|
|
111
111
|
* Attempt to fix errors when decoding the input file rather than returning an Err.
|
|
112
112
|
* Default: `false`
|
|
113
113
|
*/
|
|
114
|
-
fixErrors?: boolean
|
|
114
|
+
fixErrors?: boolean
|
|
115
115
|
/**
|
|
116
116
|
* Write to output even if there was no improvement in compression.
|
|
117
117
|
* Default: `false`
|
|
118
118
|
*/
|
|
119
|
-
force?: boolean
|
|
119
|
+
force?: boolean
|
|
120
120
|
/** Which filters to try on the file (0-5) */
|
|
121
|
-
filter?: Array<number>
|
|
121
|
+
filter?: Array<number>
|
|
122
122
|
/**
|
|
123
123
|
* Whether to attempt bit depth reduction
|
|
124
124
|
* Default: `true`
|
|
125
125
|
*/
|
|
126
|
-
bitDepthReduction?: boolean
|
|
126
|
+
bitDepthReduction?: boolean
|
|
127
127
|
/**
|
|
128
128
|
* Whether to attempt color type reduction
|
|
129
129
|
* Default: `true`
|
|
130
130
|
*/
|
|
131
|
-
colorTypeReduction?: boolean
|
|
131
|
+
colorTypeReduction?: boolean
|
|
132
132
|
/**
|
|
133
133
|
* Whether to attempt palette reduction
|
|
134
134
|
* Default: `true`
|
|
135
135
|
*/
|
|
136
|
-
paletteReduction?: boolean
|
|
136
|
+
paletteReduction?: boolean
|
|
137
137
|
/**
|
|
138
138
|
* Whether to attempt grayscale reduction
|
|
139
139
|
* Default: `true`
|
|
140
140
|
*/
|
|
141
|
-
grayscaleReduction?: boolean
|
|
141
|
+
grayscaleReduction?: boolean
|
|
142
142
|
/**
|
|
143
143
|
* Whether to perform IDAT recoding
|
|
144
144
|
* If any type of reduction is performed, IDAT recoding will be performed regardless of this setting
|
|
145
145
|
* Default: `true`
|
|
146
146
|
*/
|
|
147
|
-
idatRecoding?: boolean
|
|
147
|
+
idatRecoding?: boolean
|
|
148
148
|
/** Whether to remove ***All non-critical headers*** on PNG */
|
|
149
|
-
strip?: boolean
|
|
149
|
+
strip?: boolean
|
|
150
150
|
/** Whether to use heuristics to pick the best filter and compression */
|
|
151
|
-
useHeuristics?: boolean
|
|
151
|
+
useHeuristics?: boolean
|
|
152
152
|
}
|
|
153
153
|
export function losslessCompressPngSync(input: Buffer, options?: PNGLosslessOptions | undefined | null): Buffer
|
|
154
154
|
export function losslessCompressPng(input: Buffer, options?: PNGLosslessOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<Buffer>
|
|
155
155
|
export interface PngQuantOptions {
|
|
156
156
|
/** default is 70 */
|
|
157
|
-
minQuality?: number
|
|
157
|
+
minQuality?: number
|
|
158
158
|
/** default is 99 */
|
|
159
|
-
maxQuality?: number
|
|
159
|
+
maxQuality?: number
|
|
160
160
|
/**
|
|
161
161
|
* 1- 10
|
|
162
162
|
* Faster speeds generate images of lower quality, but may be useful for real-time generation of images.
|
|
163
163
|
* default: 5
|
|
164
164
|
*/
|
|
165
|
-
speed?: number
|
|
165
|
+
speed?: number
|
|
166
166
|
/**
|
|
167
167
|
* Number of least significant bits to ignore.
|
|
168
168
|
* Useful for generating palettes for VGA, 15-bit textures, or other retro platforms.
|
|
169
169
|
*/
|
|
170
|
-
posterization?: number
|
|
170
|
+
posterization?: number
|
|
171
171
|
}
|
|
172
172
|
export function pngQuantizeSync(input: Buffer, options?: PngQuantOptions | undefined | null): Buffer
|
|
173
173
|
export function pngQuantize(input: Buffer, options?: PngQuantOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<Buffer>
|
|
@@ -287,8 +287,8 @@ export const enum JsColorType {
|
|
|
287
287
|
export interface Metadata {
|
|
288
288
|
width: number
|
|
289
289
|
height: number
|
|
290
|
-
exif?: Record<string, string>
|
|
291
|
-
orientation?: number
|
|
290
|
+
exif?: Record<string, string>
|
|
291
|
+
orientation?: number
|
|
292
292
|
format: string
|
|
293
293
|
colorType: JsColorType
|
|
294
294
|
}
|
|
@@ -352,6 +352,10 @@ export class Transformer {
|
|
|
352
352
|
huerotate(hue: number): this
|
|
353
353
|
/** Crop a cut-out of this image delimited by the bounding rectangle. */
|
|
354
354
|
crop(x: number, y: number, width: number, height: number): this
|
|
355
|
+
/** Return this image's pixels as a native endian byte slice. */
|
|
356
|
+
rawPixels(signal?: AbortSignal | undefined | null): Promise<Buffer>
|
|
357
|
+
/** Return this image's pixels as a native endian byte slice. */
|
|
358
|
+
rawPixelsSync(): Buffer
|
|
355
359
|
/**
|
|
356
360
|
* The quality factor `quality_factor` ranges from 0 to 100 and controls the loss and quality during compression.
|
|
357
361
|
* The value 0 corresponds to low quality and small output sizes, whereas 100 is the highest quality and largest output size.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/image",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"description": "Image processing library",
|
|
@@ -61,21 +61,21 @@
|
|
|
61
61
|
},
|
|
62
62
|
"repository": "git@github.com:Brooooooklyn/Image.git",
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@napi-rs/cli": "^2.
|
|
64
|
+
"@napi-rs/cli": "^2.9.0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "e2e01fdd67e087b1468a933bbe5ea15d40a41315",
|
|
67
67
|
"optionalDependencies": {
|
|
68
|
-
"@napi-rs/image-win32-x64-msvc": "1.
|
|
69
|
-
"@napi-rs/image-darwin-x64": "1.
|
|
70
|
-
"@napi-rs/image-linux-x64-gnu": "1.
|
|
71
|
-
"@napi-rs/image-darwin-arm64": "1.
|
|
72
|
-
"@napi-rs/image-android-arm64": "1.
|
|
73
|
-
"@napi-rs/image-linux-arm64-gnu": "1.
|
|
74
|
-
"@napi-rs/image-linux-arm64-musl": "1.
|
|
75
|
-
"@napi-rs/image-linux-arm-gnueabihf": "1.
|
|
76
|
-
"@napi-rs/image-linux-x64-musl": "1.
|
|
77
|
-
"@napi-rs/image-freebsd-x64": "1.
|
|
78
|
-
"@napi-rs/image-win32-ia32-msvc": "1.
|
|
79
|
-
"@napi-rs/image-android-arm-eabi": "1.
|
|
68
|
+
"@napi-rs/image-win32-x64-msvc": "1.3.0",
|
|
69
|
+
"@napi-rs/image-darwin-x64": "1.3.0",
|
|
70
|
+
"@napi-rs/image-linux-x64-gnu": "1.3.0",
|
|
71
|
+
"@napi-rs/image-darwin-arm64": "1.3.0",
|
|
72
|
+
"@napi-rs/image-android-arm64": "1.3.0",
|
|
73
|
+
"@napi-rs/image-linux-arm64-gnu": "1.3.0",
|
|
74
|
+
"@napi-rs/image-linux-arm64-musl": "1.3.0",
|
|
75
|
+
"@napi-rs/image-linux-arm-gnueabihf": "1.3.0",
|
|
76
|
+
"@napi-rs/image-linux-x64-musl": "1.3.0",
|
|
77
|
+
"@napi-rs/image-freebsd-x64": "1.3.0",
|
|
78
|
+
"@napi-rs/image-win32-ia32-msvc": "1.3.0",
|
|
79
|
+
"@napi-rs/image-android-arm-eabi": "1.3.0"
|
|
80
80
|
}
|
|
81
81
|
}
|