imagescript 3.1.0 → 3.2.1

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.
Files changed (52) hide show
  1. package/README.md +12 -4
  2. package/dist/animation.d.ts +92 -7
  3. package/dist/animation.js +50 -20
  4. package/dist/codecs/exif.js +62 -0
  5. package/dist/codecs/gif.js +43 -27
  6. package/dist/codecs/jpeg.js +13 -1
  7. package/dist/codecs/png.js +85 -21
  8. package/dist/codecs/quantize.js +2 -2
  9. package/dist/codecs/tga.js +47 -4
  10. package/dist/codecs/vp8l.js +27 -30
  11. package/dist/codecs/webp.js +23 -10
  12. package/dist/frame.d.ts +30 -2
  13. package/dist/frame.js +20 -9
  14. package/dist/gif.d.ts +10 -7
  15. package/dist/gif.js +7 -5
  16. package/dist/image-type.d.ts +1 -0
  17. package/dist/image-type.js +1 -0
  18. package/dist/image.d.ts +231 -31
  19. package/dist/image.js +118 -53
  20. package/dist/index.d.ts +14 -4
  21. package/dist/index.js +6 -4
  22. package/dist/metadata.d.ts +35 -0
  23. package/dist/metadata.js +43 -0
  24. package/dist/render/svg.js +39 -21
  25. package/dist/util/blur.js +88 -0
  26. package/dist/util/optimize.js +264 -0
  27. package/dist/util/options.js +3 -0
  28. package/dist/util/resample.js +244 -63
  29. package/dist/util/utf8.js +4 -51
  30. package/dist/version.js +1 -1
  31. package/package.json +9 -2
  32. package/dist/codecs/crc.d.ts +0 -9
  33. package/dist/codecs/exif.d.ts +0 -11
  34. package/dist/codecs/gif.d.ts +0 -44
  35. package/dist/codecs/jpeg.d.ts +0 -35
  36. package/dist/codecs/png.d.ts +0 -97
  37. package/dist/codecs/quantize.d.ts +0 -25
  38. package/dist/codecs/tga.d.ts +0 -16
  39. package/dist/codecs/tiff.d.ts +0 -6
  40. package/dist/codecs/vp8-tables.d.ts +0 -10
  41. package/dist/codecs/vp8.d.ts +0 -8
  42. package/dist/codecs/vp8l.d.ts +0 -62
  43. package/dist/codecs/webp.d.ts +0 -67
  44. package/dist/codecs/zlib.d.ts +0 -22
  45. package/dist/render/font.d.ts +0 -92
  46. package/dist/render/hinting.d.ts +0 -110
  47. package/dist/render/svg.d.ts +0 -11
  48. package/dist/render/text.d.ts +0 -63
  49. package/dist/util/blur.d.ts +0 -13
  50. package/dist/util/resample.d.ts +0 -12
  51. package/dist/util/utf8.d.ts +0 -5
  52. package/dist/version.d.ts +0 -1
package/dist/image.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { BinaryData } from './util/mem.js';
2
2
  import { TextLayout } from './text-layout.js';
3
+ import { Metadata } from './metadata.js';
3
4
  /** A color as a 32-bit RGBA integer (`0xRRGGBBAA`) */
4
5
  export type Color = number;
5
6
  /** Called with a pixel's (0-based) coordinates, returns its color */
@@ -12,11 +13,81 @@ export type SVGScaleMode = 1 | 2 | 3;
12
13
  export type BlendMode = 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'add';
13
14
  /** Options of {@link Image.composite} */
14
15
  export interface CompositeOptions {
16
+ /** The x position to place the source at, if the options are the second argument. Default: `0` */
17
+ x?: number;
18
+ /** The y position to place the source at, if the options are the second argument. Default: `0` */
19
+ y?: number;
15
20
  /** Opacity of the source (0..1). Default: `1` */
16
21
  opacity?: number;
17
22
  /** How the colors are mixed. Default: `'normal'` */
18
23
  mode?: BlendMode;
19
24
  }
25
+ /** Options of {@link Image.scale}, {@link Image.resize}, {@link Image.contain}, {@link Image.fit} and {@link Image.cover} */
26
+ export interface ResizeOptions {
27
+ /** The resizing mode. Default: {@link Image.RESIZE_BILINEAR} */
28
+ mode?: ResizeMode;
29
+ }
30
+ /**
31
+ * Options of {@link Image.opacity}, {@link Image.red}, {@link Image.green}, {@link Image.blue}, {@link Image.lightness}
32
+ * and {@link Image.saturation}
33
+ */
34
+ export interface AdjustOptions {
35
+ /** Whether to set the value (true) or scale the current one (false). Default: `false` */
36
+ absolute?: boolean;
37
+ }
38
+ /** Options of {@link Image.sharpen} */
39
+ export interface SharpenOptions {
40
+ /** How strongly to sharpen (0 does nothing). Default: `1` */
41
+ amount?: number;
42
+ /** The radius of the blur the image is compared with (larger values sharpen coarser details). Default: `1` */
43
+ radius?: number;
44
+ }
45
+ /** Options of {@link Image.encode} */
46
+ export interface PNGEncodeOptions {
47
+ /** The compression level (0-9). Default: `1` */
48
+ compression?: number;
49
+ /** Metadata to include, see {@link Metadata} */
50
+ metadata?: Metadata;
51
+ }
52
+ /** Options of {@link Image.encodeJPEG} */
53
+ export interface JPEGEncodeOptions {
54
+ /** The JPEG quality (1-100), chroma subsampling is disabled above 90. Default: `90` */
55
+ quality?: number;
56
+ /** Metadata to include, see {@link Metadata} */
57
+ metadata?: Metadata;
58
+ }
59
+ /** Options of {@link Image.encodeWebP} and {@link Image.encodeTGA} */
60
+ export interface EncodeOptions {
61
+ /** Metadata to include, see {@link Metadata} */
62
+ metadata?: Metadata;
63
+ }
64
+ /** Options of {@link Image.roundCorners} */
65
+ export interface RoundCornersOptions {
66
+ /** The radius of the corners. Default: a quarter of the smaller side */
67
+ radius?: number;
68
+ }
69
+ /** Options of {@link Image.fisheye} */
70
+ export interface FisheyeOptions {
71
+ /** The distortion strength (exponent of the radial mapping), higher values bulge the center more. Default: `2` */
72
+ strength?: number;
73
+ }
74
+ /** Options of {@link Image.renderSVG} */
75
+ export interface SVGOptions {
76
+ /** The scale, or the width or height in pixels, see `mode`. Default: `1` */
77
+ size?: number;
78
+ /**
79
+ * What `size` is: one of {@link Image.SVG_MODE_SCALE}, {@link Image.SVG_MODE_WIDTH}, {@link Image.SVG_MODE_HEIGHT}.
80
+ * Default: {@link Image.SVG_MODE_SCALE}
81
+ */
82
+ mode?: SVGScaleMode;
83
+ }
84
+ /** Options of {@link Image.renderText}: the text color and layout, and its style (see {@link TextStyle}) */
85
+ export interface TextOptions extends TextStyle {
86
+ /** The text color. Default: `0xffffffff` */
87
+ color?: Color;
88
+ /** The text layout. Default: `new TextLayout()` */
89
+ layout?: TextLayout;
90
+ }
20
91
  /** Options of {@link Image.decode} */
21
92
  export interface DecodeOptions {
22
93
  /** Whether to rotate/mirror JPEGs, TIFFs, PNGs and WebPs as their orientation tag (Exif or XMP) says. Default: `true` */
@@ -56,6 +127,14 @@ export interface RotateOptions {
56
127
  /** Whether to resize the image so it fits all pixels or just ignore outlying pixels. Default: `true` */
57
128
  resize?: boolean;
58
129
  }
130
+ /** Options of {@link Image.trim} */
131
+ export interface TrimOptions {
132
+ /**
133
+ * How far (0-1) a pixel's channels may be from the color for it to be trimmed, e.g. for JPEG artifacts or
134
+ * antialiasing. Default: `0`
135
+ */
136
+ tolerance?: number;
137
+ }
59
138
  /** Options of {@link Image.colorToAlpha} */
60
139
  export interface ColorToAlphaOptions {
61
140
  /** Pixels at most this far from the color (0-1) become fully transparent. Default: 0 */
@@ -63,29 +142,11 @@ export interface ColorToAlphaOptions {
63
142
  /** Pixels at least this far from the color (0-1) stay fully opaque. Default: 1 */
64
143
  opacityThreshold?: number;
65
144
  }
66
- /** Text metadata written into PNGs by {@link Image.encode} */
67
- export interface PNGMetadata {
68
- /** The image's title */
69
- title?: string;
70
- /** The image's author */
71
- author?: string;
72
- /** The image's description */
73
- description?: string;
74
- /** The image's copyright info */
75
- copyright?: string;
76
- /** The image's creation time. Default: now */
77
- creationTime?: string | number | Date;
78
- /** The software used to create the image. Default: `'github.com/matmen/ImageScript vX.X.X'`, `''` leaves it out */
79
- software?: string;
80
- /** A disclaimer for the image */
81
- disclaimer?: string;
82
- /** A warning for the image */
83
- warning?: string;
84
- /** The image's source */
85
- source?: string;
86
- /** A comment for the image */
87
- comment?: string;
88
- }
145
+ /**
146
+ * Text metadata written into PNGs
147
+ * @deprecated Use {@link Metadata}, which all encoders take
148
+ */
149
+ export type PNGMetadata = Metadata;
89
150
  /**
90
151
  * An RGBA image; provides the codecs and the manipulation functions. Methods that change the image modify it in place
91
152
  * and return it, so calls can be chained
@@ -237,12 +298,27 @@ export declare class Image {
237
298
  * Used for automatically preserving an images aspect ratio when resizing.
238
299
  */
239
300
  static get RESIZE_AUTO(): -1;
301
+ /**
302
+ * Resizes the image by the given factor
303
+ * @param factor The factor to resize the image with
304
+ * @param options See {@link ResizeOptions}
305
+ */
306
+ scale(factor: number, options?: ResizeOptions): this;
240
307
  /**
241
308
  * Resizes the image by the given factor
242
309
  * @param factor The factor to resize the image with
243
310
  * @param [mode=Image.RESIZE_BILINEAR] The resizing mode to use
244
311
  */
245
312
  scale(factor: number, mode?: ResizeMode): this;
313
+ /**
314
+ * Resizes the image to the given dimensions.
315
+ * Use {@link Image.RESIZE_AUTO} as either width or height to automatically preserve the aspect ratio.
316
+ * @param width The new width
317
+ * @param height The new height
318
+ * @param options See {@link ResizeOptions}
319
+ * @returns The resized image
320
+ */
321
+ resize(width: number, height: number, options?: ResizeOptions): this;
246
322
  /**
247
323
  * Resizes the image to the given dimensions.
248
324
  * Use {@link Image.RESIZE_AUTO} as either width or height to automatically preserve the aspect ratio.
@@ -252,6 +328,15 @@ export declare class Image {
252
328
  * @returns The resized image
253
329
  */
254
330
  resize(width: number, height: number, mode?: ResizeMode): this;
331
+ /**
332
+ * Resizes the image so it is contained in the given bounding box.
333
+ * Can return an image with one axis smaller than the given bounding box.
334
+ * @param width The width of the bounding box
335
+ * @param height The height of the bounding box
336
+ * @param options See {@link ResizeOptions}
337
+ * @returns The resized image
338
+ */
339
+ contain(width: number, height: number, options?: ResizeOptions): this;
255
340
  /**
256
341
  * Resizes the image so it is contained in the given bounding box.
257
342
  * Can return an image with one axis smaller than the given bounding box.
@@ -261,6 +346,15 @@ export declare class Image {
261
346
  * @returns The resized image
262
347
  */
263
348
  contain(width: number, height: number, mode?: ResizeMode): this;
349
+ /**
350
+ * Resizes the image so it is contained in the given bounding box, placing it in the center of the given bounding box.
351
+ * Always returns the exact dimensions of the bounding box.
352
+ * @param width The width of the bounding box
353
+ * @param height The height of the bounding box
354
+ * @param options See {@link ResizeOptions}
355
+ * @returns The resized image
356
+ */
357
+ fit(width: number, height: number, options?: ResizeOptions): this;
264
358
  /**
265
359
  * Resizes the image so it is contained in the given bounding box, placing it in the center of the given bounding box.
266
360
  * Always returns the exact dimensions of the bounding box.
@@ -270,6 +364,15 @@ export declare class Image {
270
364
  * @returns The resized image
271
365
  */
272
366
  fit(width: number, height: number, mode?: ResizeMode): this;
367
+ /**
368
+ * Resizes the image so it covers the given bounding box, cropping the overflowing edges.
369
+ * Always returns the exact dimensions of the bounding box.
370
+ * @param width The width of the bounding box
371
+ * @param height The height of the bounding box
372
+ * @param options See {@link ResizeOptions}
373
+ * @returns The resized image
374
+ */
375
+ cover(width: number, height: number, options?: ResizeOptions): this;
273
376
  /**
274
377
  * Resizes the image so it covers the given bounding box, cropping the overflowing edges.
275
378
  * Always returns the exact dimensions of the bounding box.
@@ -288,6 +391,15 @@ export declare class Image {
288
391
  * @param height The new images height
289
392
  */
290
393
  crop(x: number, y: number, width: number, height: number): this;
394
+ /**
395
+ * Removes borders of one color, e.g. the empty space around rendered text or around a logo on a solid background.
396
+ * Frames keep their position: their offsets move by the trimmed amount. An image that only has the color stays
397
+ * unchanged
398
+ * @param color The border color, by default the color of the top left pixel. Fully transparent pixels count as the
399
+ * same color whatever their RGB values
400
+ * @param options See {@link TrimOptions}
401
+ */
402
+ trim(color?: Color, options?: TrimOptions): this;
291
403
  /**
292
404
  * Draws a box at the specified coordinates (0-based), clipped to the image
293
405
  * @param x The x offset
@@ -316,42 +428,84 @@ export declare class Image {
316
428
  * @param feathering Share of the radius (0..1) over which the edge fades out. Default: `0`
317
429
  */
318
430
  cropCircle(max?: boolean, feathering?: number): this;
431
+ /**
432
+ * Sets the images opacity
433
+ * @param opacity The opacity to apply (0..1)
434
+ * @param options See {@link AdjustOptions}
435
+ */
436
+ opacity(opacity: number, options?: AdjustOptions): this;
319
437
  /**
320
438
  * Sets the images opacity
321
439
  * @param opacity The opacity to apply (0..1)
322
440
  * @param absolute Whether to scale the current opacity (false) or just set the new opacity (true)
323
441
  */
324
442
  opacity(opacity: number, absolute?: boolean): this;
443
+ /**
444
+ * Scales or sets the red channel
445
+ * @param factor The factor to multiply the channel with (>= 0, results are clamped), or the value (0..1) to set it to
446
+ * @param options See {@link AdjustOptions}
447
+ */
448
+ red(factor: number, options?: AdjustOptions): this;
325
449
  /**
326
450
  * Scales or sets the red channel
327
451
  * @param factor The factor to multiply the channel with (>= 0, results are clamped), or the value (0..1) to set it to
328
452
  * @param absolute Whether to scale the current value (false) or set every pixel's red channel to `factor` * 255 (true)
329
453
  */
330
454
  red(factor: number, absolute?: boolean): this;
455
+ /**
456
+ * Scales or sets the green channel
457
+ * @param factor The factor to multiply the channel with (>= 0, results are clamped), or the value (0..1) to set it to
458
+ * @param options See {@link AdjustOptions}
459
+ */
460
+ green(factor: number, options?: AdjustOptions): this;
331
461
  /**
332
462
  * Scales or sets the green channel
333
463
  * @param factor The factor to multiply the channel with (>= 0, results are clamped), or the value (0..1) to set it to
334
464
  * @param absolute Whether to scale the current value (false) or set every pixel's green channel to `factor` * 255 (true)
335
465
  */
336
466
  green(factor: number, absolute?: boolean): this;
467
+ /**
468
+ * Scales or sets the blue channel
469
+ * @param factor The factor to multiply the channel with (>= 0, results are clamped), or the value (0..1) to set it to
470
+ * @param options See {@link AdjustOptions}
471
+ */
472
+ blue(factor: number, options?: AdjustOptions): this;
337
473
  /**
338
474
  * Scales or sets the blue channel
339
475
  * @param factor The factor to multiply the channel with (>= 0, results are clamped), or the value (0..1) to set it to
340
476
  * @param absolute Whether to scale the current value (false) or set every pixel's blue channel to `factor` * 255 (true)
341
477
  */
342
478
  blue(factor: number, absolute?: boolean): this;
479
+ /**
480
+ * Sets the brightness of the image
481
+ * @param value The lightness to apply (0..1)
482
+ * @param options See {@link AdjustOptions}
483
+ */
484
+ lightness(value: number, options?: AdjustOptions): this;
343
485
  /**
344
486
  * Sets the brightness of the image
345
487
  * @param value The lightness to apply (0..1)
346
488
  * @param absolute Whether to scale the current lightness (false) or just set the new lightness (true)
347
489
  */
348
490
  lightness(value: number, absolute?: boolean): this;
491
+ /**
492
+ * Sets the saturation of the image
493
+ * @param value The saturation to apply (0..1)
494
+ * @param options See {@link AdjustOptions}
495
+ */
496
+ saturation(value: number, options?: AdjustOptions): this;
349
497
  /**
350
498
  * Sets the saturation of the image
351
499
  * @param value The saturation to apply (0..1)
352
500
  * @param absolute Whether to scale the current saturation (false) or just set the new saturation (true)
353
501
  */
354
502
  saturation(value: number, absolute?: boolean): this;
503
+ /**
504
+ * Composites (overlays) the source onto this image
505
+ * @param source The image to place
506
+ * @param options Position, opacity and blend mode, see {@link CompositeOptions}
507
+ */
508
+ composite(source: Image, options?: CompositeOptions): this;
355
509
  /**
356
510
  * Composites (overlays) the source onto this image at the specified coordinates
357
511
  * @param source The image to place
@@ -383,6 +537,11 @@ export declare class Image {
383
537
  * @param radius The blur radius: the gaussian's standard deviation in pixels, like CSS' blur()
384
538
  */
385
539
  blur(radius: number): this;
540
+ /**
541
+ * Sharpens the image with an unsharp mask: the difference to a blurred copy is amplified
542
+ * @param options See {@link SharpenOptions}
543
+ */
544
+ sharpen(options?: SharpenOptions): this;
386
545
  /**
387
546
  * Sharpens the image with an unsharp mask: the difference to a blurred copy is amplified
388
547
  * @param [amount=1] How strongly to sharpen (0 does nothing)
@@ -466,11 +625,21 @@ export declare class Image {
466
625
  * @return The gradient generator. The function argument is the position in the gradient (0..1).
467
626
  */
468
627
  static gradient(colors: Record<number, Color>): (position: number) => Color;
628
+ /**
629
+ * Rounds the images corners, with antialiased edges
630
+ * @param options See {@link RoundCornersOptions}
631
+ */
632
+ roundCorners(options?: RoundCornersOptions): this;
469
633
  /**
470
634
  * Rounds the images corners, with antialiased edges
471
635
  * @param [radius=min(width,height)/4] The radius of the corners
472
636
  */
473
637
  roundCorners(radius?: number): this;
638
+ /**
639
+ * Applies a fisheye (barrel distortion) effect
640
+ * @param options See {@link FisheyeOptions}
641
+ */
642
+ fisheye(options?: FisheyeOptions): this;
474
643
  /**
475
644
  * Applies a fisheye (barrel distortion) effect
476
645
  * @param [strength=2] The distortion strength (exponent of the radial mapping), higher values bulge the center more
@@ -479,22 +648,34 @@ export declare class Image {
479
648
  /**
480
649
  * Encodes the image into a PNG, with the smallest lossless color type (a palette for up to 256 colors,
481
650
  * greyscale or RGB, alpha only if needed). Uses the runtime's native zlib when available
651
+ * @param options See {@link PNGEncodeOptions}
652
+ * @return The encoded data
653
+ */
654
+ encode(options?: PNGEncodeOptions): Promise<Uint8Array>;
655
+ /**
656
+ * Encodes the image into a PNG
482
657
  * @param compression The compression level (0-9). Default: `1`
483
- * @param metadata Text metadata to include
658
+ * @param metadata Metadata to include, see {@link Metadata}
484
659
  * @return The encoded data
485
660
  */
486
- encode(compression?: number, metadata?: PNGMetadata): Promise<Uint8Array>;
661
+ encode(compression?: number, metadata?: Metadata): Promise<Uint8Array>;
487
662
  /**
488
663
  * Encodes the image into a PNG with compression level 1
489
- * @param metadata Text metadata to include
664
+ * @param metadata Metadata to include, see {@link Metadata}
490
665
  * @return The encoded data
491
666
  */
492
- encode(metadata?: PNGMetadata): Promise<Uint8Array>;
667
+ encode(metadata?: Metadata): Promise<Uint8Array>;
493
668
  /**
494
669
  * Encodes the image into a PNG, an alias of {@link Image.encode}
495
670
  */
496
- encodePNG(compression?: number, metadata?: PNGMetadata): Promise<Uint8Array>;
497
- encodePNG(metadata?: PNGMetadata): Promise<Uint8Array>;
671
+ encodePNG(options?: PNGEncodeOptions): Promise<Uint8Array>;
672
+ encodePNG(compression?: number, metadata?: Metadata): Promise<Uint8Array>;
673
+ encodePNG(metadata?: Metadata): Promise<Uint8Array>;
674
+ /**
675
+ * Encodes the image into a JPEG
676
+ * @param options See {@link JPEGEncodeOptions}
677
+ */
678
+ encodeJPEG(options?: JPEGEncodeOptions): Promise<Uint8Array>;
498
679
  /**
499
680
  * Encodes the image into a JPEG
500
681
  * @param [quality=90] The JPEG quality to use (1-100), chroma subsampling is disabled above 90
@@ -502,12 +683,14 @@ export declare class Image {
502
683
  encodeJPEG(quality?: number): Promise<Uint8Array>;
503
684
  /**
504
685
  * Encodes the image as lossless WebP (usually 20-30% smaller than PNG, but slower to encode)
686
+ * @param options See {@link EncodeOptions}
505
687
  */
506
- encodeWebP(): Promise<Uint8Array>;
688
+ encodeWebP({ metadata }?: EncodeOptions): Promise<Uint8Array>;
507
689
  /**
508
690
  * Encodes the image as run length encoded TGA (32 bit, or 24 bit if the image is opaque)
691
+ * @param options See {@link EncodeOptions}
509
692
  */
510
- encodeTGA(): Promise<Uint8Array>;
693
+ encodeTGA({ metadata }?: EncodeOptions): Promise<Uint8Array>;
511
694
  /**
512
695
  * Decodes an image (PNG, JPEG, TIFF, WebP or TGA). For APNGs this is the default image; animated WebPs and GIFs
513
696
  * have no single image, decode those with {@link Animation.decode}
@@ -534,11 +717,28 @@ export declare class Image {
534
717
  * Supports shapes, paths, transforms, use/symbol, CSS styles, gradients, strokes, clip paths, masks and opacity;
535
718
  * text, images, filters and patterns are not rendered
536
719
  * @param svg The SVG content
720
+ * @param options See {@link SVGOptions}
721
+ * @return The rendered SVG graphic
722
+ */
723
+ static renderSVG(svg: string | BinaryData, options?: SVGOptions): Promise<Image>;
724
+ /**
725
+ * Creates a new image from the given SVG
726
+ * @param svg The SVG content
537
727
  * @param size The size to use
538
728
  * @param mode The SVG resizing mode to use (one of {@link SVG_MODE_SCALE}, {@link SVG_MODE_WIDTH}, {@link SVG_MODE_HEIGHT})
539
729
  * @return The rendered SVG graphic
540
730
  */
541
731
  static renderSVG(svg: string | BinaryData, size?: number, mode?: SVGScaleMode): Promise<Image>;
732
+ /**
733
+ * Creates a new image containing the rendered text.
734
+ * @param font TrueType (ttf/ttc) or OpenType (otf) font buffer to use
735
+ * @param size Font size in pixels (per em)
736
+ * @param text Text to render
737
+ * @param options Color, layout and style, see {@link TextOptions}; the image grows by the outline width on every
738
+ * side
739
+ * @return The rendered text
740
+ */
741
+ static renderText(font: BinaryData, size: number, text: string, options?: TextOptions): Promise<Image>;
542
742
  /**
543
743
  * Creates a new image containing the rendered text.
544
744
  * @param font TrueType (ttf/ttc) or OpenType (otf) font buffer to use