imagescript 3.16.1 → 3.18.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/dist/colors.js ADDED
@@ -0,0 +1,161 @@
1
+ import { finite, color as checkColor } from "./util/options.js";
2
+ export function channel(value) {
3
+ return value > 255 ? 255 : value > 0 ? Math.round(value) : 0;
4
+ }
5
+ export function wrapHue(h) {
6
+ const t = h - Math.trunc(h) + 1;
7
+ return t < 1 ? t : t < 2 ? t - 1 : 0;
8
+ }
9
+ export function hue2rgb(p, q, t) {
10
+ if (t < 0)
11
+ t += 1;
12
+ if (t > 1)
13
+ t -= 1;
14
+ if (t < 1 / 6)
15
+ return p + (q - p) * 6 * t;
16
+ if (t < 1 / 2)
17
+ return q;
18
+ if (t < 2 / 3)
19
+ return p + (q - p) * (2 / 3 - t) * 6;
20
+ return p;
21
+ }
22
+ export function rgbaToHSLA(r, g, b, a) {
23
+ r = finite(r, 'red') / 255;
24
+ g = finite(g, 'green') / 255;
25
+ b = finite(b, 'blue') / 255;
26
+ a = finite(a, 'alpha');
27
+ const max = Math.max(r, g, b), min = Math.min(r, g, b);
28
+ let h = 0, s;
29
+ const l = (max + min) / 2;
30
+ if (max === min) {
31
+ h = s = 0;
32
+ }
33
+ else {
34
+ const d = max - min;
35
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
36
+ switch (max) {
37
+ case r:
38
+ h = (g - b) / d + (g < b ? 6 : 0);
39
+ break;
40
+ case g:
41
+ h = (b - r) / d + 2;
42
+ break;
43
+ case b:
44
+ h = (r - g) / d + 4;
45
+ break;
46
+ }
47
+ h /= 6;
48
+ }
49
+ return [h, s, l, a / 255];
50
+ }
51
+ function gradientBetween(startColor, endColor) {
52
+ const sr = startColor >>> 24;
53
+ const sg = startColor >> 16 & 0xff;
54
+ const sb = startColor >> 8 & 0xff;
55
+ const sa = startColor & 0xff;
56
+ const er = (endColor >>> 24) - sr;
57
+ const eg = (endColor >> 16 & 0xff) - sg;
58
+ const eb = (endColor >> 8 & 0xff) - sb;
59
+ const ea = (endColor & 0xff) - sa;
60
+ return position => {
61
+ const r = sr + position * er;
62
+ const g = sg + position * eg;
63
+ const b = sb + position * eb;
64
+ const a = sa + position * ea;
65
+ return (((r & 0xff) << 24) | ((g & 0xff) << 16) | ((b & 0xff) << 8) | (a & 0xff)) >>> 0;
66
+ };
67
+ }
68
+ export class Colors {
69
+ constructor() { }
70
+ static fromRGBA(r, g, b, a) {
71
+ r = finite(r, 'red');
72
+ g = finite(g, 'green');
73
+ b = finite(b, 'blue');
74
+ a = finite(a, 'alpha');
75
+ return (channel(r) << 24 | channel(g) << 16 | channel(b) << 8 | channel(a)) >>> 0;
76
+ }
77
+ static fromRGB(r, g, b) {
78
+ return Colors.fromRGBA(r, g, b, 0xff);
79
+ }
80
+ static fromHSLA(h, s, l, a) {
81
+ h = wrapHue(finite(h, 'hue'));
82
+ s = finite(s, 'saturation');
83
+ l = finite(l, 'lightness');
84
+ a = finite(a, 'alpha');
85
+ s = Math.min(1, Math.max(0, s));
86
+ l = Math.min(1, Math.max(0, l));
87
+ a = Math.min(1, Math.max(0, a));
88
+ let r, g, b;
89
+ if (s === 0) {
90
+ r = g = b = l;
91
+ }
92
+ else {
93
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
94
+ const p = 2 * l - q;
95
+ r = hue2rgb(p, q, h + 1 / 3);
96
+ g = hue2rgb(p, q, h);
97
+ b = hue2rgb(p, q, h - 1 / 3);
98
+ }
99
+ return Colors.fromRGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), Math.round(a * 255));
100
+ }
101
+ static fromHSL(h, s, l) {
102
+ return Colors.fromHSLA(h, s, l, 1);
103
+ }
104
+ static toRGBA(color) {
105
+ color = checkColor(color);
106
+ return [(color >> 24) & 0xff, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff];
107
+ }
108
+ static toRGB(color) {
109
+ const [r, g, b] = Colors.toRGBA(color);
110
+ return [r, g, b];
111
+ }
112
+ static toHSLA(color) {
113
+ const [r, g, b, a] = Colors.toRGBA(color);
114
+ return rgbaToHSLA(r, g, b, a);
115
+ }
116
+ static gradient(colors) {
117
+ const entries = Object.entries(colors).sort((a, b) => Number(a[0]) - Number(b[0]));
118
+ const positions = entries.map(e => finite(parseFloat(e[0]), 'gradient position'));
119
+ const values = entries.map(e => checkColor(e[1]));
120
+ if (positions.length === 0)
121
+ throw new RangeError('Invalid gradient point count');
122
+ else if (positions.length === 1) {
123
+ return () => values[0];
124
+ }
125
+ else if (positions.length === 2) {
126
+ const gradient = gradientBetween(values[0], values[1]);
127
+ return position => {
128
+ if (position <= positions[0])
129
+ return values[0];
130
+ if (position >= positions[1])
131
+ return values[1];
132
+ return gradient((position - positions[0]) / (positions[1] - positions[0]));
133
+ };
134
+ }
135
+ const minDef = Math.min(...positions);
136
+ const maxDef = Math.max(...positions);
137
+ const gradients = [];
138
+ for (let i = 0; i < positions.length; i++) {
139
+ const minPos = positions[i - 1];
140
+ if (minPos === undefined)
141
+ continue;
142
+ const maxPos = positions[i];
143
+ let minVal = values[i - 1];
144
+ if (minVal === undefined)
145
+ minVal = values[i];
146
+ const maxVal = values[i];
147
+ const gradient = gradientBetween(minVal, maxVal);
148
+ gradients.push({ min: minPos, max: maxPos, gradient });
149
+ }
150
+ return position => {
151
+ if (position <= minDef)
152
+ return gradients[0].gradient(0);
153
+ if (position >= maxDef)
154
+ return gradients[gradients.length - 1].gradient(1);
155
+ for (const gradient of gradients)
156
+ if (position >= gradient.min && position <= gradient.max)
157
+ return gradient.gradient((position - gradient.min) / (gradient.max - gradient.min));
158
+ throw new RangeError(`Invalid gradient position: ${position}`);
159
+ };
160
+ }
161
+ }
package/dist/frame.d.ts CHANGED
@@ -1,8 +1,24 @@
1
- import { Image, ResizeMode, ResizeOptions, Color, TrimOptions } from './image.js';
1
+ import { Image, ResizeMode, ResizeOptions, ResizeToOptions, Color, TrimOptions } from './image.js';
2
2
  /** Names of the frame disposal modes, see {@link Frame.disposalMode} */
3
3
  export type FrameDisposalModeName = 'any' | 'keep' | 'previous' | 'background';
4
- /** Ids of the frame disposal modes, as GIFs store them (0 any, 1 keep, 2 previous, 3 background) */
4
+ /**
5
+ * Ids of the frame disposal modes, as GIFs store them (0 any, 1 keep, 2 previous, 3 background)
6
+ * @deprecated Use the names ({@link FrameDisposalModeName}: `'any'`, `'keep'`, `'previous'`, `'background'`), the ids will
7
+ * be removed in 4.0
8
+ */
5
9
  export type FrameDisposalModeId = 0 | 1 | 2 | 3;
10
+ /** What happens to a frame's area before the next frame is drawn, see {@link Frame.disposalMode} */
11
+ export declare class FrameDisposalModes {
12
+ /** The decoder decides (in practice like {@link FrameDisposalModes.KEEP}) */
13
+ static readonly ANY = "any";
14
+ /** The frame stays, the next one is drawn over it (the default) */
15
+ static readonly KEEP = "keep";
16
+ /** The frame's area goes back to what it was before the frame */
17
+ static readonly PREVIOUS = "previous";
18
+ /** The frame's area is cleared to transparent */
19
+ static readonly BACKGROUND = "background";
20
+ private constructor();
21
+ }
6
22
  /** Options of {@link Frame} and {@link Frame.from} */
7
23
  export interface FrameOptions {
8
24
  /** The frame's duration in milliseconds. Default: `100` */
@@ -15,7 +31,8 @@ export interface FrameOptions {
15
31
  disposalMode?: FrameDisposalModeName | FrameDisposalModeId;
16
32
  }
17
33
  /**
18
- * Represents a frame of an {@link Animation}
34
+ * Represents a frame of an {@link Animation}: an {@link Image} with a duration, offsets and a disposal mode, so every
35
+ * method of {@link Image} works on it too
19
36
  */
20
37
  export declare class Frame extends Image {
21
38
  /**
@@ -27,30 +44,53 @@ export declare class Frame extends Image {
27
44
  xOffset: number;
28
45
  /** The frame's vertical offset in the animation */
29
46
  yOffset: number;
30
- /** Frame disposal mode ANY: the decoder decides (in practice like KEEP). For use with {@link Frame} */
31
- static get DISPOSAL_ANY(): 'any';
32
- /** Frame disposal mode KEEP. For use with {@link Frame} */
33
- static get DISPOSAL_KEEP(): 'keep';
34
- /** Frame disposal mode PREVIOUS. For use with {@link Frame} */
35
- static get DISPOSAL_PREVIOUS(): 'previous';
36
- /** Frame disposal mode BACKGROUND. For use with {@link Frame} */
37
- static get DISPOSAL_BACKGROUND(): 'background';
47
+ /**
48
+ * @deprecated Use {@link FrameDisposalModes.ANY}, `Frame.DISPOSAL_*` will be removed in 4.0
49
+ * @group Deprecated
50
+ */
51
+ static readonly DISPOSAL_ANY: typeof FrameDisposalModes.ANY;
52
+ /**
53
+ * @deprecated Use {@link FrameDisposalModes.KEEP}, `Frame.DISPOSAL_*` will be removed in 4.0
54
+ * @group Deprecated
55
+ */
56
+ static readonly DISPOSAL_KEEP: typeof FrameDisposalModes.KEEP;
57
+ /**
58
+ * @deprecated Use {@link FrameDisposalModes.PREVIOUS}, `Frame.DISPOSAL_*` will be removed in 4.0
59
+ * @group Deprecated
60
+ */
61
+ static readonly DISPOSAL_PREVIOUS: typeof FrameDisposalModes.PREVIOUS;
62
+ /**
63
+ * @deprecated Use {@link FrameDisposalModes.BACKGROUND}, `Frame.DISPOSAL_*` will be removed in 4.0
64
+ * @group Deprecated
65
+ */
66
+ static readonly DISPOSAL_BACKGROUND: typeof FrameDisposalModes.BACKGROUND;
38
67
  /**
39
68
  * Creates a new, blank frame
69
+ * @param width The width in pixels
70
+ * @param height The height in pixels
40
71
  * @param options See {@link FrameOptions}
41
72
  */
42
73
  constructor(width: number, height: number, options?: FrameOptions);
43
74
  /**
44
75
  * Creates a new, blank frame
76
+ * @param width The width in pixels
77
+ * @param height The height in pixels
45
78
  * @param duration The frame's duration (in ms)
46
79
  * @param xOffset The frame's offset on the x-axis
47
80
  * @param yOffset The frame's offset on the y-axis
48
81
  * @param disposalMode The frame's disposal mode
82
+ * @deprecated Pass {@link FrameOptions} instead, the positional arguments will be removed in 4.0
49
83
  */
50
84
  constructor(width: number, height: number, duration?: number, xOffset?: number, yOffset?: number, disposalMode?: FrameDisposalModeName | FrameDisposalModeId);
51
- /** The frame's disposal mode (`'any'`, `'keep'`, `'previous'` or `'background'`); also settable by id (0-3) */
85
+ /**
86
+ * The frame's disposal mode (`'any'`, `'keep'`, `'previous'` or `'background'`). Setting it by id (0-3) is deprecated,
87
+ * the ids will be removed in 4.0
88
+ */
52
89
  get disposalMode(): FrameDisposalModeName;
53
- /** Sets the disposal mode by name or id (0-3) */
90
+ /**
91
+ * Sets the disposal mode
92
+ * @param disposalMode The mode's name (`'any'`, `'keep'`, `'previous'`, `'background'`) or, deprecated, its id (0-3)
93
+ */
54
94
  set disposalMode(disposalMode: FrameDisposalModeName | FrameDisposalModeId);
55
95
  /** A short description for debugging, e.g. `Frame<64x64x100ms>` */
56
96
  toString(): string;
@@ -67,20 +107,45 @@ export declare class Frame extends Image {
67
107
  * @param xOffset The frame's offset on the x-axis
68
108
  * @param yOffset The frame's offset on the y-axis
69
109
  * @param disposalMode The frame's disposal mode
110
+ * @deprecated Pass {@link FrameOptions} instead, the positional arguments will be removed in 4.0
70
111
  */
71
112
  static from(image: Image, duration?: number, xOffset?: number, yOffset?: number, disposalMode?: FrameDisposalModeName | FrameDisposalModeId): Frame;
72
113
  /**
73
114
  * Clones the frame, including its duration, offsets and disposal mode
74
115
  */
75
116
  clone(): Frame;
117
+ /**
118
+ * Removes borders of one color, moving the frame's offsets so the remaining pixels stay in place
119
+ * @param options See {@link TrimOptions}
120
+ */
121
+ trim(options?: TrimOptions): this;
76
122
  /**
77
123
  * Removes borders of one color, moving the frame's offsets so the remaining pixels stay in place
78
124
  * @param color The border color, by default the color of the top left pixel
79
125
  * @param options See {@link TrimOptions}
126
+ * @deprecated Pass {@link TrimOptions} instead, the positional arguments will be removed in 4.0
80
127
  */
81
128
  trim(color?: Color, options?: TrimOptions): this;
82
129
  /**
83
- * Resizes the frame, scaling its offsets along with it
130
+ * Resizes the frame, scaling its offsets along with it.
131
+ * Pass {@link ResizeToOptions} with only a width or a height to keep the aspect ratio.
132
+ * @param width The new width
133
+ * @param height The new height
134
+ * @param options See {@link ResizeOptions}
135
+ */
136
+ resize(width: number, height: number, options?: ResizeOptions): this;
137
+ /**
138
+ * Resizes the frame, scaling its offsets along with it.
139
+ * @param width The new width
140
+ * @param height The new height
141
+ * @param mode The resizing mode (default: {@link ResizeModes.BILINEAR})
142
+ * @deprecated Pass {@link ResizeOptions} with `mode` instead, the positional mode will be removed in 4.0
143
+ */
144
+ resize(width: number, height: number, mode?: ResizeMode): this;
145
+ /**
146
+ * Resizes the frame, scaling its offsets along with it: to the given width or height (the other side keeps the
147
+ * aspect ratio), or to both
148
+ * @param options The size and how to resize, see {@link ResizeToOptions}
84
149
  */
85
- resize(width: number, height: number, modeOrOptions?: ResizeMode | ResizeOptions): this;
150
+ resize(options: ResizeToOptions): this;
86
151
  }
package/dist/frame.js CHANGED
@@ -1,23 +1,22 @@
1
- import { Image } from "./image.js";
1
+ import { Image, resizeArguments } from "./image.js";
2
2
  import { isOptions, finite } from "./util/options.js";
3
3
  const DISPOSAL_MODES = ['any', 'keep', 'previous', 'background'];
4
+ export class FrameDisposalModes {
5
+ static ANY = 'any';
6
+ static KEEP = 'keep';
7
+ static PREVIOUS = 'previous';
8
+ static BACKGROUND = 'background';
9
+ constructor() { }
10
+ }
4
11
  export class Frame extends Image {
5
12
  duration;
6
13
  xOffset;
7
14
  yOffset;
8
15
  __disposalMode__ = 1;
9
- static get DISPOSAL_ANY() {
10
- return 'any';
11
- }
12
- static get DISPOSAL_KEEP() {
13
- return 'keep';
14
- }
15
- static get DISPOSAL_PREVIOUS() {
16
- return 'previous';
17
- }
18
- static get DISPOSAL_BACKGROUND() {
19
- return 'background';
20
- }
16
+ static DISPOSAL_ANY = FrameDisposalModes.ANY;
17
+ static DISPOSAL_KEEP = FrameDisposalModes.KEEP;
18
+ static DISPOSAL_PREVIOUS = FrameDisposalModes.PREVIOUS;
19
+ static DISPOSAL_BACKGROUND = FrameDisposalModes.BACKGROUND;
21
20
  static __convert_disposal_mode__(mode) {
22
21
  const id = typeof mode === 'string' ? DISPOSAL_MODES.indexOf(mode) : mode;
23
22
  if (!(id >= 0 && id <= 3))
@@ -25,7 +24,7 @@ export class Frame extends Image {
25
24
  return id;
26
25
  }
27
26
  constructor(width, height, durationOrOptions, xOffset, yOffset, disposalMode) {
28
- const { duration = 100, xOffset: x = 0, yOffset: y = 0, disposalMode: disposal = Frame.DISPOSAL_KEEP } = isOptions(durationOrOptions) ? durationOrOptions : { duration: durationOrOptions, xOffset, yOffset, disposalMode };
27
+ const { duration = 100, xOffset: x = 0, yOffset: y = 0, disposalMode: disposal = FrameDisposalModes.KEEP } = isOptions(durationOrOptions) ? durationOrOptions : { duration: durationOrOptions, xOffset, yOffset, disposalMode };
29
28
  if (finite(duration, 'frame duration') < 0)
30
29
  throw new RangeError('Invalid frame duration');
31
30
  finite(x, 'x offset');
@@ -59,7 +58,8 @@ export class Frame extends Image {
59
58
  clone() {
60
59
  return Frame.from(this, { duration: this.duration, xOffset: this.xOffset, yOffset: this.yOffset, disposalMode: this.disposalMode });
61
60
  }
62
- trim(color, options = {}) {
61
+ trim(colorOrOptions, optionsArgument = {}) {
62
+ const { color, ...options } = isOptions(colorOrOptions) ? colorOrOptions : { ...optionsArgument, color: colorOrOptions ?? optionsArgument.color };
63
63
  const bounds = this.__trim_bounds__(color, options);
64
64
  if (!bounds)
65
65
  return this;
@@ -67,7 +67,8 @@ export class Frame extends Image {
67
67
  this.yOffset += bounds[1];
68
68
  return this.__apply__(this.__crop__(...bounds));
69
69
  }
70
- resize(width, height, modeOrOptions) {
70
+ resize(widthOrOptions, heightArgument, modeArgument) {
71
+ const [width, height, modeOrOptions] = resizeArguments(widthOrOptions, heightArgument, modeArgument);
71
72
  const originalWidth = this.width;
72
73
  const originalHeight = this.height;
73
74
  super.resize(width, height, modeOrOptions);
package/dist/gainmap.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import { Image } from './image.js';
2
2
  import { BinaryData } from './util/mem.js';
3
+ /** Options of {@link GainMap.encode} */
4
+ export interface GainMapEncodeOptions {
5
+ /** The JPEG quality (1-100). Default: `90` */
6
+ quality?: number;
7
+ }
3
8
  /** Options of the {@link GainMap} constructor: per channel values can be one number for all three or [r, g, b] */
4
9
  export interface GainMapOptions {
5
10
  /** log2 of the boost of the map's value 0 (`-1`: half as bright). Default: `0` */
@@ -58,6 +63,10 @@ export declare class GainMap {
58
63
  private __check__;
59
64
  /** The map's pixels. Changes to them are written when the image is encoded */
60
65
  get image(): Image;
66
+ /**
67
+ * Replaces the map's pixels
68
+ * @param image The new map, at any resolution: it covers the whole image
69
+ */
61
70
  set image(image: Image);
62
71
  /** The map's width */
63
72
  get width(): number;
@@ -67,10 +76,17 @@ export declare class GainMap {
67
76
  get channels(): 1 | 3;
68
77
  /** Clones the gain map (its pixels too) */
69
78
  clone(): GainMap;
79
+ /**
80
+ * Encodes the gain map alone: a JPEG with its parameters (hdrgm XMP and ISO 21496-1), like the second image in an
81
+ * Ultra HDR JPEG
82
+ * @param options See {@link GainMapEncodeOptions}
83
+ */
84
+ encode(options?: GainMapEncodeOptions): Promise<Uint8Array>;
70
85
  /**
71
86
  * Encodes the gain map alone: a JPEG with its parameters (hdrgm XMP and ISO 21496-1), like the second image in an
72
87
  * Ultra HDR JPEG
73
88
  * @param quality The JPEG quality (1-100). Default: `90`
89
+ * @deprecated Pass {@link GainMapEncodeOptions} instead, the positional arguments will be removed in 4.0
74
90
  */
75
91
  encode(quality?: number): Promise<Uint8Array>;
76
92
  /**
package/dist/gainmap.js CHANGED
@@ -2,7 +2,7 @@ import { Image } from "./image.js";
2
2
  import * as jpeg from "./codecs/jpeg.js";
3
3
  import * as codec from "./codecs/gainmap.js";
4
4
  import { view } from "./util/mem.js";
5
- import { finite, quality as checkQuality } from "./util/options.js";
5
+ import { finite, isOptions, quality as checkQuality } from "./util/options.js";
6
6
  const perChannel = (value, name) => {
7
7
  const values = typeof value === 'number' ? [value, value, value] : Array.from(value);
8
8
  if (values.length === 1)
@@ -177,7 +177,8 @@ export class GainMap {
177
177
  }
178
178
  this.image = out;
179
179
  }
180
- async encode(quality) {
180
+ async encode(qualityOrOptions) {
181
+ let quality = isOptions(qualityOrOptions) ? qualityOrOptions.quality : qualityOrOptions;
181
182
  if (quality !== undefined)
182
183
  quality = Math.max(1, checkQuality(quality));
183
184
  return codec.mapWithMetadata(this.__body__(quality), this.__params__());
package/dist/gif.d.ts CHANGED
@@ -6,12 +6,13 @@ import { Animation, AnimationDecodeOptions, AnimationOptions, GIFEncodeOptions }
6
6
  * Array methods like map and filter return plain arrays.
7
7
  * @deprecated Use {@link Animation}, which works the same and also handles APNG: `new Animation(frames, loopCount)`,
8
8
  * {@link Animation.decode} and {@link Animation.encodeGIF}. `GIF` will be removed in 4.0
9
+ * @group Deprecated
9
10
  */
10
11
  export declare class GIF extends Animation {
11
12
  /**
12
13
  * Creates a new GIF image
13
14
  * @param frames The frames to create the GIF from
14
- * @param loopCountOrOptions How many times to repeat the GIF (-1 = forever, 0 = play once), or see
15
+ * @param loopCountOrOptions How many times to repeat the GIF (`Infinity` = forever, 0 = play once), or see
15
16
  * {@link AnimationOptions}
16
17
  */
17
18
  constructor(frames: Frame[], loopCountOrOptions?: number | AnimationOptions);
@@ -10,30 +10,69 @@ export declare class ImageType {
10
10
  * @returns The image type, or null if it isn't supported
11
11
  */
12
12
  static getType(data: BinaryData): ImageTypeName | null;
13
- /** Whether the data starts like a PNG */
13
+ /**
14
+ * Whether the data starts like a PNG
15
+ * @param data The file's data
16
+ */
14
17
  static isPNG(data: BinaryData): boolean;
15
- /** Whether the data starts like a JPEG */
18
+ /**
19
+ * Whether the data starts like a JPEG
20
+ * @param data The file's data
21
+ */
16
22
  static isJPEG(data: BinaryData): boolean;
17
- /** Whether the data starts like a TIFF (or BigTIFF) */
23
+ /**
24
+ * Whether the data starts like a TIFF (or BigTIFF)
25
+ * @param data The file's data
26
+ */
18
27
  static isTIFF(data: BinaryData): boolean;
19
- /** Whether the data starts like a GIF */
28
+ /**
29
+ * Whether the data starts like a GIF
30
+ * @param data The file's data
31
+ */
20
32
  static isGIF(data: BinaryData): boolean;
21
- /** Whether the data starts like a WebP */
33
+ /**
34
+ * Whether the data starts like a WebP
35
+ * @param data The file's data
36
+ */
22
37
  static isWebP(data: BinaryData): boolean;
23
- /** Whether the data starts like an AVIF (the avif or avis brand) */
38
+ /**
39
+ * Whether the data starts like an AVIF (the avif or avis brand)
40
+ * @param data The file's data
41
+ */
24
42
  static isAVIF(data: BinaryData): boolean;
25
- /** Whether the data starts like a JPEG XL (a codestream or the container) */
43
+ /**
44
+ * Whether the data starts like a JPEG XL (a codestream or the container)
45
+ * @param data The file's data
46
+ */
26
47
  static isJXL(data: BinaryData): boolean;
27
- /** Whether the data starts like a BMP */
48
+ /**
49
+ * Whether the data starts like a BMP
50
+ * @param data The file's data
51
+ */
28
52
  static isBMP(data: BinaryData): boolean;
29
- /** Whether the data is a Windows icon or cursor (ICO or CUR) */
53
+ /**
54
+ * Whether the data is a Windows icon or cursor (ICO or CUR)
55
+ * @param data The file's data
56
+ */
30
57
  static isICO(data: BinaryData): boolean;
31
- /** Whether the data starts like a QOI */
58
+ /**
59
+ * Whether the data starts like a QOI
60
+ * @param data The file's data
61
+ */
32
62
  static isQOI(data: BinaryData): boolean;
33
- /** Whether the data starts like a Netpbm image (PBM, PGM, PPM, PAM or PFM) */
63
+ /**
64
+ * Whether the data starts like a Netpbm image (PBM, PGM, PPM, PAM or PFM)
65
+ * @param data The file's data
66
+ */
34
67
  static isPNM(data: BinaryData): boolean;
35
- /** Whether the data starts like a Radiance HDR */
68
+ /**
69
+ * Whether the data starts like a Radiance HDR
70
+ * @param data The file's data
71
+ */
36
72
  static isHDR(data: BinaryData): boolean;
37
- /** Whether the data looks like a TGA (which has no magic number: its header has to be consistent) */
73
+ /**
74
+ * Whether the data looks like a TGA (which has no magic number: its header has to be consistent)
75
+ * @param data The file's data
76
+ */
38
77
  static isTGA(data: BinaryData): boolean;
39
78
  }