wasm-vips 0.0.16 → 0.0.17

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.
Binary file
package/lib/vips.d.ts CHANGED
@@ -33,6 +33,15 @@ declare module Vips {
33
33
  type Enum = string | number;
34
34
  type Flag = string | number;
35
35
  type Blob = string | ArrayBuffer | Uint8Array | Uint8ClampedArray | Int8Array;
36
+ type Memory =
37
+ Int8Array
38
+ | Uint8Array
39
+ | Int16Array
40
+ | Uint16Array
41
+ | Int32Array
42
+ | Uint32Array
43
+ | Float32Array
44
+ | Float64Array;
36
45
  type ArrayConstant = SingleOrArray<number>;
37
46
  type ArrayImage = SingleOrArray<Image> | Vector<Image>;
38
47
  type DeletionFuncs<T extends EmbindClassHandle<T>> = EmbindClassHandle<T>[];
@@ -169,7 +178,7 @@ declare module Vips {
169
178
  /**
170
179
  * A sequence container representing an array that can change in size.
171
180
  */
172
- interface Vector<T> extends EmbindClassHandle<Vector<T>> {
181
+ interface Vector<T> extends EmbindClassHandle<Vector<T>>, Iterable<T> {
173
182
  /**
174
183
  * Adds a new element at the end of the vector, after its current last element.
175
184
  * @param val The value to be appended at the end of the container.
@@ -274,6 +283,13 @@ declare module Vips {
274
283
  * Handy utilities.
275
284
  */
276
285
  abstract class Utils {
286
+ /**
287
+ * Return the GType for a name.
288
+ * @param name Type name to lookup.
289
+ * @return Corresponding type ID, or `0` if not found.
290
+ */
291
+ static typeFromName(name: string): number;
292
+
277
293
  /**
278
294
  * Get the GType for a name.
279
295
  * Looks up the GType for a nickname. Types below basename in the type hierarchy are searched.
@@ -296,9 +312,9 @@ declare module Vips {
296
312
  */
297
313
  abstract class Connection extends EmbindClassHandle<Connection> {
298
314
  /**
299
- * Get the filename associated with a connection.
315
+ * The filename associated with a connection, if any.
300
316
  */
301
- readonly filename: string;
317
+ readonly filename?: string;
302
318
 
303
319
  /**
304
320
  * Make a human-readable name for a connection suitable for error messages.
@@ -509,9 +525,14 @@ declare module Vips {
509
525
  readonly yres: number;
510
526
 
511
527
  /**
512
- * Image filename.
528
+ * Image filename, if any.
529
+ */
530
+ readonly filename?: string;
531
+
532
+ /**
533
+ * The associated gainmap image, if any.
513
534
  */
514
- readonly filename: string;
535
+ readonly gainmap?: Image;
515
536
 
516
537
  /**
517
538
  * Page height in pixels.
@@ -639,7 +660,7 @@ declare module Vips {
639
660
  * @param format Band format.
640
661
  * @return A new image.
641
662
  */
642
- static newFromMemory(data: Blob, width: number, height: number, bands: number, format: BandFormat): Image;
663
+ static newFromMemory(data: Memory, width: number, height: number, bands: number, format: BandFormat): Image;
643
664
 
644
665
  /**
645
666
  * Wrap an image around a pointer.
@@ -850,7 +871,7 @@ declare module Vips {
850
871
  * will return a four byte typed array containing the values 1, 2, 3, 4.
851
872
  * @return A typed array of 8-bit unsigned integer values.
852
873
  */
853
- writeToMemory(): Uint8Array;
874
+ writeToMemory(): Memory;
854
875
 
855
876
  //#endregion
856
877
 
@@ -891,6 +912,14 @@ declare module Vips {
891
912
  */
892
913
  setString(name: string, value: string): void;
893
914
 
915
+ /**
916
+ * Set an image to another image as metadata.
917
+ * This is typically used to update the gainmap.
918
+ * @param name The name of the piece of metadata to set the value of.
919
+ * @param value The metadata value.
920
+ */
921
+ setImage(name: string, value: Image): void;
922
+
894
923
  /**
895
924
  * Set a blob on an image as metadata.
896
925
  * The value will internally be copied from JavaScript to WASM.
@@ -1757,7 +1786,15 @@ declare module Vips {
1757
1786
  /**
1758
1787
  * Pixels are HSV
1759
1788
  */
1760
- hsv = 29 // 'hsv'
1789
+ hsv = 29, // 'hsv'
1790
+ /**
1791
+ * Pixels are in Oklab colourspace
1792
+ */
1793
+ oklab = 30, // 'oklab'
1794
+ /**
1795
+ * Pixels are in Oklch colourspace
1796
+ */
1797
+ oklch = 31 // 'oklch'
1761
1798
  }
1762
1799
 
1763
1800
  /**
@@ -1999,8 +2036,7 @@ declare module Vips {
1999
2036
  /**
2000
2037
  * Top-to-bottom reading only, but with a small buffer
2001
2038
  */
2002
- sequential = 1, // 'sequential'
2003
- sequential_unbuffered = 2 // 'sequential-unbuffered'
2039
+ sequential = 1 // 'sequential'
2004
2040
  }
2005
2041
 
2006
2042
  /**
@@ -2494,6 +2530,12 @@ declare module Vips {
2494
2530
 
2495
2531
  /**
2496
2532
  * How to calculate the output pixels when shrinking a 2x2 region.
2533
+ *
2534
+ * Images with alpha (see [method@Image.hasalpha]) always shrink with
2535
+ * [enum@Vips.RegionShrink.MEAN] and pixels scaled by alpha to avoid fringing.
2536
+ *
2537
+ * Set the image interpretation to [enum@Vips.Interpretation.MULTIBAND] to
2538
+ * treat all bands equally.
2497
2539
  */
2498
2540
  enum RegionShrink {
2499
2541
  /**
@@ -2651,35 +2693,35 @@ declare module Vips {
2651
2693
  */
2652
2694
  enum Kernel {
2653
2695
  /**
2654
- * The nearest pixel to the point.
2696
+ * The nearest pixel to the point
2655
2697
  */
2656
2698
  nearest = 0, // 'nearest'
2657
2699
  /**
2658
- * Convolve with a triangle filter.
2700
+ * Convolve with a triangle filter
2659
2701
  */
2660
2702
  linear = 1, // 'linear'
2661
2703
  /**
2662
- * Convolve with a cubic filter.
2704
+ * Convolve with a cubic filter
2663
2705
  */
2664
2706
  cubic = 2, // 'cubic'
2665
2707
  /**
2666
- * Convolve with a Mitchell kernel.
2708
+ * Convolve with a Mitchell kernel
2667
2709
  */
2668
2710
  mitchell = 3, // 'mitchell'
2669
2711
  /**
2670
- * Convolve with a two-lobe Lanczos kernel.
2712
+ * Convolve with a two-lobe Lanczos kernel
2671
2713
  */
2672
2714
  lanczos2 = 4, // 'lanczos2'
2673
2715
  /**
2674
- * Convolve with a three-lobe Lanczos kernel.
2716
+ * Convolve with a three-lobe Lanczos kernel
2675
2717
  */
2676
2718
  lanczos3 = 5, // 'lanczos3'
2677
2719
  /**
2678
- * Convolve with Magic Kernel Sharp 2013.
2720
+ * Convolve with Magic Kernel Sharp 2013
2679
2721
  */
2680
2722
  mks2013 = 6, // 'mks2013'
2681
2723
  /**
2682
- * Convolve with Magic Kernel Sharp 2021.
2724
+ * Convolve with Magic Kernel Sharp 2021
2683
2725
  */
2684
2726
  mks2021 = 7 // 'mks2021'
2685
2727
  }
@@ -2762,13 +2804,17 @@ declare module Vips {
2762
2804
  */
2763
2805
  icc = 8, // 'icc'
2764
2806
  /**
2765
- * Keep other metadata (e.g. PNG comments and some TIFF tags)
2807
+ * Keep other metadata (e.g. PNG comments)
2766
2808
  */
2767
2809
  other = 16, // 'other'
2810
+ /**
2811
+ * Keep the gainmap metadata
2812
+ */
2813
+ gainmap = 32, // 'gainmap'
2768
2814
  /**
2769
2815
  * Keep all metadata
2770
2816
  */
2771
- all = 31 // 'all'
2817
+ all = 63 // 'all'
2772
2818
  }
2773
2819
 
2774
2820
  /**
@@ -4393,14 +4439,18 @@ declare module Vips {
4393
4439
  * Array of input images.
4394
4440
  */
4395
4441
  _in?: ArrayImage | ArrayConstant
4442
+ /**
4443
+ * Format for input filename.
4444
+ */
4445
+ in_format?: string
4396
4446
  /**
4397
4447
  * Format for output filename.
4398
4448
  */
4399
4449
  out_format?: string
4400
4450
  /**
4401
- * Format for input filename.
4451
+ * Cache this call.
4402
4452
  */
4403
- in_format?: string
4453
+ cache?: boolean
4404
4454
  /**
4405
4455
  * Output image (output).
4406
4456
  */
@@ -4744,6 +4794,97 @@ declare module Vips {
4744
4794
  H?: number
4745
4795
  }): Image;
4746
4796
 
4797
+ /**
4798
+ * Load a uhdr image.
4799
+ * @param filename Filename to load from.
4800
+ * @param options Optional options.
4801
+ * @return Output image.
4802
+ */
4803
+ static uhdrload(filename: string, options?: {
4804
+ /**
4805
+ * Shrink factor on load.
4806
+ */
4807
+ shrink?: number
4808
+ /**
4809
+ * Force open via memory.
4810
+ */
4811
+ memory?: boolean
4812
+ /**
4813
+ * Required access pattern for this file.
4814
+ */
4815
+ access?: Access | Enum
4816
+ /**
4817
+ * Error level to fail on.
4818
+ */
4819
+ fail_on?: FailOn | Enum
4820
+ /**
4821
+ * Don't use a cached result for this operation.
4822
+ */
4823
+ revalidate?: boolean
4824
+ /**
4825
+ * Flags for this file (output).
4826
+ */
4827
+ flags?: number | undefined
4828
+ }): Image;
4829
+
4830
+ /**
4831
+ * Load a uhdr image.
4832
+ * @param buffer Buffer to load from.
4833
+ * @param options Optional options.
4834
+ * @return Output image.
4835
+ */
4836
+ static uhdrloadBuffer(buffer: Blob, options?: {
4837
+ /**
4838
+ * Shrink factor on load.
4839
+ */
4840
+ shrink?: number
4841
+ /**
4842
+ * Force open via memory.
4843
+ */
4844
+ memory?: boolean
4845
+ /**
4846
+ * Required access pattern for this file.
4847
+ */
4848
+ access?: Access | Enum
4849
+ /**
4850
+ * Error level to fail on.
4851
+ */
4852
+ fail_on?: FailOn | Enum
4853
+ /**
4854
+ * Flags for this file (output).
4855
+ */
4856
+ flags?: number | undefined
4857
+ }): Image;
4858
+
4859
+ /**
4860
+ * Load a uhdr image.
4861
+ * @param source Source to load from.
4862
+ * @param options Optional options.
4863
+ * @return Output image.
4864
+ */
4865
+ static uhdrloadSource(source: Source, options?: {
4866
+ /**
4867
+ * Shrink factor on load.
4868
+ */
4869
+ shrink?: number
4870
+ /**
4871
+ * Force open via memory.
4872
+ */
4873
+ memory?: boolean
4874
+ /**
4875
+ * Required access pattern for this file.
4876
+ */
4877
+ access?: Access | Enum
4878
+ /**
4879
+ * Error level to fail on.
4880
+ */
4881
+ fail_on?: FailOn | Enum
4882
+ /**
4883
+ * Flags for this file (output).
4884
+ */
4885
+ flags?: number | undefined
4886
+ }): Image;
4887
+
4747
4888
  /**
4748
4889
  * Load vips from file.
4749
4890
  * @param filename Filename to load from.
@@ -5057,6 +5198,24 @@ declare module Vips {
5057
5198
  */
5058
5199
  LabS2LabQ(): Image;
5059
5200
 
5201
+ /**
5202
+ * Transform oklab to oklch.
5203
+ * @return Output image.
5204
+ */
5205
+ Oklab2Oklch(): Image;
5206
+
5207
+ /**
5208
+ * Transform oklab to xyz.
5209
+ * @return Output image.
5210
+ */
5211
+ Oklab2XYZ(): Image;
5212
+
5213
+ /**
5214
+ * Transform oklch to oklab.
5215
+ * @return Output image.
5216
+ */
5217
+ Oklch2Oklab(): Image;
5218
+
5060
5219
  /**
5061
5220
  * Transform xyz to cmyk.
5062
5221
  * @return Output image.
@@ -5075,6 +5234,12 @@ declare module Vips {
5075
5234
  temp?: ArrayConstant
5076
5235
  }): Image;
5077
5236
 
5237
+ /**
5238
+ * Transform xyz to oklab.
5239
+ * @return Output image.
5240
+ */
5241
+ XYZ2Oklab(): Image;
5242
+
5078
5243
  /**
5079
5244
  * Transform xyz to yxy.
5080
5245
  * @return Output image.
@@ -6130,6 +6295,10 @@ declare module Vips {
6130
6295
  * Select encoder to use.
6131
6296
  */
6132
6297
  encoder?: ForeignHeifEncoder | Enum
6298
+ /**
6299
+ * Tuning parameters.
6300
+ */
6301
+ tune?: string
6133
6302
  /**
6134
6303
  * Which metadata to retain.
6135
6304
  */
@@ -6182,6 +6351,10 @@ declare module Vips {
6182
6351
  * Select encoder to use.
6183
6352
  */
6184
6353
  encoder?: ForeignHeifEncoder | Enum
6354
+ /**
6355
+ * Tuning parameters.
6356
+ */
6357
+ tune?: string
6185
6358
  /**
6186
6359
  * Which metadata to retain.
6187
6360
  */
@@ -6234,6 +6407,10 @@ declare module Vips {
6234
6407
  * Select encoder to use.
6235
6408
  */
6236
6409
  encoder?: ForeignHeifEncoder | Enum
6410
+ /**
6411
+ * Tuning parameters.
6412
+ */
6413
+ tune?: string
6237
6414
  /**
6238
6415
  * Which metadata to retain.
6239
6416
  */
@@ -6555,7 +6732,7 @@ declare module Vips {
6555
6732
  }): Image;
6556
6733
 
6557
6734
  /**
6558
- * Save image to jpeg file.
6735
+ * Save as jpeg.
6559
6736
  * @param filename Filename to save to.
6560
6737
  * @param options Optional options.
6561
6738
  */
@@ -6615,7 +6792,7 @@ declare module Vips {
6615
6792
  }): void;
6616
6793
 
6617
6794
  /**
6618
- * Save image to jpeg buffer.
6795
+ * Save as jpeg.
6619
6796
  * @param options Optional options.
6620
6797
  * @return Buffer to save to.
6621
6798
  */
@@ -6734,7 +6911,7 @@ declare module Vips {
6734
6911
  }): void;
6735
6912
 
6736
6913
  /**
6737
- * Save image to jpeg target.
6914
+ * Save as jpeg.
6738
6915
  * @param target Target to save to.
6739
6916
  * @param options Optional options.
6740
6917
  */
@@ -6819,6 +6996,10 @@ declare module Vips {
6819
6996
  * Quality factor.
6820
6997
  */
6821
6998
  Q?: number
6999
+ /**
7000
+ * Bit depth.
7001
+ */
7002
+ bitdepth?: number
6822
7003
  /**
6823
7004
  * Which metadata to retain.
6824
7005
  */
@@ -6863,6 +7044,10 @@ declare module Vips {
6863
7044
  * Quality factor.
6864
7045
  */
6865
7046
  Q?: number
7047
+ /**
7048
+ * Bit depth.
7049
+ */
7050
+ bitdepth?: number
6866
7051
  /**
6867
7052
  * Which metadata to retain.
6868
7053
  */
@@ -6907,6 +7092,10 @@ declare module Vips {
6907
7092
  * Quality factor.
6908
7093
  */
6909
7094
  Q?: number
7095
+ /**
7096
+ * Bit depth.
7097
+ */
7098
+ bitdepth?: number
6910
7099
  /**
6911
7100
  * Which metadata to retain.
6912
7101
  */
@@ -7413,7 +7602,7 @@ declare module Vips {
7413
7602
  */
7414
7603
  interlace?: boolean
7415
7604
  /**
7416
- * Libspng row filter flag(s).
7605
+ * Libpng row filter flag(s).
7417
7606
  */
7418
7607
  filter?: ForeignPngFilter | Flag
7419
7608
  /**
@@ -7469,7 +7658,7 @@ declare module Vips {
7469
7658
  */
7470
7659
  interlace?: boolean
7471
7660
  /**
7472
- * Libspng row filter flag(s).
7661
+ * Libpng row filter flag(s).
7473
7662
  */
7474
7663
  filter?: ForeignPngFilter | Flag
7475
7664
  /**
@@ -7525,7 +7714,7 @@ declare module Vips {
7525
7714
  */
7526
7715
  interlace?: boolean
7527
7716
  /**
7528
- * Libspng row filter flag(s).
7717
+ * Libpng row filter flag(s).
7529
7718
  */
7530
7719
  filter?: ForeignPngFilter | Flag
7531
7720
  /**
@@ -8691,6 +8880,96 @@ declare module Vips {
8691
8880
  page_height?: number
8692
8881
  }): Image;
8693
8882
 
8883
+ /**
8884
+ * Transform uhdr to scrgb.
8885
+ * @return Output image.
8886
+ */
8887
+ uhdr2scRGB(): Image;
8888
+
8889
+ /**
8890
+ * Save image in ultrahdr format.
8891
+ * @param filename Filename to save to.
8892
+ * @param options Optional options.
8893
+ */
8894
+ uhdrsave(filename: string, options?: {
8895
+ /**
8896
+ * Q factor.
8897
+ */
8898
+ Q?: number
8899
+ /**
8900
+ * Which metadata to retain.
8901
+ */
8902
+ keep?: ForeignKeep | Flag
8903
+ /**
8904
+ * Background value.
8905
+ */
8906
+ background?: ArrayConstant
8907
+ /**
8908
+ * Set page height for multipage save.
8909
+ */
8910
+ page_height?: number
8911
+ /**
8912
+ * Filename of icc profile to embed.
8913
+ */
8914
+ profile?: string
8915
+ }): void;
8916
+
8917
+ /**
8918
+ * Save image in ultrahdr format.
8919
+ * @param options Optional options.
8920
+ * @return Buffer to save to.
8921
+ */
8922
+ uhdrsaveBuffer(options?: {
8923
+ /**
8924
+ * Q factor.
8925
+ */
8926
+ Q?: number
8927
+ /**
8928
+ * Which metadata to retain.
8929
+ */
8930
+ keep?: ForeignKeep | Flag
8931
+ /**
8932
+ * Background value.
8933
+ */
8934
+ background?: ArrayConstant
8935
+ /**
8936
+ * Set page height for multipage save.
8937
+ */
8938
+ page_height?: number
8939
+ /**
8940
+ * Filename of icc profile to embed.
8941
+ */
8942
+ profile?: string
8943
+ }): Uint8Array;
8944
+
8945
+ /**
8946
+ * Save image in ultrahdr format.
8947
+ * @param target Target to save to.
8948
+ * @param options Optional options.
8949
+ */
8950
+ uhdrsaveTarget(target: Target, options?: {
8951
+ /**
8952
+ * Q factor.
8953
+ */
8954
+ Q?: number
8955
+ /**
8956
+ * Which metadata to retain.
8957
+ */
8958
+ keep?: ForeignKeep | Flag
8959
+ /**
8960
+ * Background value.
8961
+ */
8962
+ background?: ArrayConstant
8963
+ /**
8964
+ * Set page height for multipage save.
8965
+ */
8966
+ page_height?: number
8967
+ /**
8968
+ * Filename of icc profile to embed.
8969
+ */
8970
+ profile?: string
8971
+ }): void;
8972
+
8694
8973
  /**
8695
8974
  * Unpremultiply image alpha.
8696
8975
  * @param options Optional options.
@@ -8769,6 +9048,10 @@ declare module Vips {
8769
9048
  * Enable lossless compression.
8770
9049
  */
8771
9050
  lossless?: boolean
9051
+ /**
9052
+ * Preserve color values from transparent pixels.
9053
+ */
9054
+ exact?: boolean
8772
9055
  /**
8773
9056
  * Preset for lossy compression.
8774
9057
  */
@@ -8849,6 +9132,10 @@ declare module Vips {
8849
9132
  * Enable lossless compression.
8850
9133
  */
8851
9134
  lossless?: boolean
9135
+ /**
9136
+ * Preserve color values from transparent pixels.
9137
+ */
9138
+ exact?: boolean
8852
9139
  /**
8853
9140
  * Preset for lossy compression.
8854
9141
  */
@@ -8928,6 +9215,10 @@ declare module Vips {
8928
9215
  * Enable lossless compression.
8929
9216
  */
8930
9217
  lossless?: boolean
9218
+ /**
9219
+ * Preserve color values from transparent pixels.
9220
+ */
9221
+ exact?: boolean
8931
9222
  /**
8932
9223
  * Preset for lossy compression.
8933
9224
  */
@@ -9008,6 +9299,10 @@ declare module Vips {
9008
9299
  * Enable lossless compression.
9009
9300
  */
9010
9301
  lossless?: boolean
9302
+ /**
9303
+ * Preserve color values from transparent pixels.
9304
+ */
9305
+ exact?: boolean
9011
9306
  /**
9012
9307
  * Preset for lossy compression.
9013
9308
  */