@visulima/storage 1.0.9 → 1.0.11
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/CHANGELOG.md +17 -0
- package/dist/adapter/nuxt/module.d.ts +9 -8
- package/dist/ai/ai-sdk/index.d.ts +52 -59
- package/dist/ai/claude/index.d.ts +105 -119
- package/dist/ai/openai/index.d.ts +87 -99
- package/dist/ai/tanstack/index.d.ts +54 -61
- package/dist/handler/http/fetch/index.d.ts +202 -201
- package/dist/handler/http/fetch/index.js +1 -1
- package/dist/handler/http/hono/index.d.ts +60 -59
- package/dist/handler/http/hono/index.js +1 -1
- package/dist/handler/http/nextjs/index.d.ts +55 -54
- package/dist/handler/http/nextjs/index.js +1 -1
- package/dist/handler/http/node/index.d.ts +234 -246
- package/dist/handler/http/node/index.js +1 -1
- package/dist/handler/http/solid-start/index.d.ts +55 -54
- package/dist/handler/http/solid-start/index.js +1 -1
- package/dist/index.d.ts +71 -70
- package/dist/index.js +1 -1
- package/dist/packem_shared/{AbstractBaseStorage-CiPEMcuo.js → AbstractBaseStorage-CLsYmMZg.js} +1 -1
- package/dist/packem_shared/AwsLightStorage-DGSPFUqr.js +1 -0
- package/dist/packem_shared/AzureStorage-DvKk_hhz.js +1 -0
- package/dist/packem_shared/BoxMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BoxStorage-DbGqBLux.js → BoxStorage-CmM95wi2.js} +1 -1
- package/dist/packem_shared/BunS3MetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BunS3Storage-DNvimm9e.js → BunS3Storage-B_roVJ29.js} +1 -1
- package/dist/packem_shared/BunnyMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BunnyStorage-C7d0opLL.js → BunnyStorage-eZ1QDVaY.js} +1 -1
- package/dist/packem_shared/CloudinaryMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{CloudinaryStorage-Dc3XA2lP.js → CloudinaryStorage-CpH2f0Fv.js} +1 -1
- package/dist/packem_shared/DiskStorage-DzjjqCzo.js +1 -0
- package/dist/packem_shared/{DiskStorageWithChecksum-vFCubS6K.js → DiskStorageWithChecksum-MZkDEyts.js} +1 -1
- package/dist/packem_shared/DropboxMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{DropboxStorage-CY9Ggu3m.js → DropboxStorage-BB9NoWK2.js} +1 -1
- package/dist/packem_shared/{Files-CpIcMjP0.js → Files-DyMJ9FPN.js} +1 -1
- package/dist/packem_shared/FirebaseMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{FirebaseStorage-D6O9CJXN.js → FirebaseStorage-BgbxzYNC.js} +1 -1
- package/dist/packem_shared/FtpMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{FtpStorage-DbEjbq8z.js → FtpStorage-CNqXDz7P.js} +1 -1
- package/dist/packem_shared/{GCSMetaStorage-DT8K6zdm.js → GCSMetaStorage-gEhWlpfS.js} +1 -1
- package/dist/packem_shared/{GCStorage-6BHkFlEs.js → GCStorage-CRd5vjok.js} +1 -1
- package/dist/packem_shared/GoogleDriveMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{GoogleDriveStorage-Bklsz7Bh.js → GoogleDriveStorage-Du7uBhSm.js} +1 -1
- package/dist/packem_shared/{LocalMetaStorage-BhicZnNl.js → LocalMetaStorage-CcGfFG39.js} +1 -1
- package/dist/packem_shared/{MemoryStorage-9gbWd09l.js → MemoryStorage-ChKyI6OY.js} +1 -1
- package/dist/packem_shared/{Multipart-D0ok6BBy.js → Multipart-C35TR2qL.js} +1 -1
- package/dist/packem_shared/{Multipart-CQjYqU--.js → Multipart-V64Bg5dt.js} +1 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/NetlifyBlobStorage-CZsr_0DF.js +1 -0
- package/dist/packem_shared/OneDriveMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{OneDriveStorage-CP6MvGAa.js → OneDriveStorage-B8qFgMq1.js} +1 -1
- package/dist/packem_shared/PocketBaseMetaStorage-Cm3v8g1-.js +1 -0
- package/dist/packem_shared/{PocketBaseStorage-2qhbI2PW.js → PocketBaseStorage-D2vMN-oY.js} +1 -1
- package/dist/packem_shared/{Rest-CI_BiZPv.js → Rest-B7g1sgkq.js} +1 -1
- package/dist/packem_shared/{Rest-DvfN4-kf.js → Rest-BrEMYgxZ.js} +1 -1
- package/dist/packem_shared/{S3Storage-YGeNk3Tt.js → S3Storage-CTe_BMDl.js} +1 -1
- package/dist/packem_shared/SftpMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{SftpStorage-2Hz396Xr.js → SftpStorage-BKeAzuej.js} +1 -1
- package/dist/packem_shared/SharePointMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{SharePointStorage-CrX2Pk6C.js → SharePointStorage-Dtnt5-wk.js} +1 -1
- package/dist/packem_shared/SupabaseMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{SupabaseStorage-Dc_DBX29.js → SupabaseStorage-CmGQjqXf.js} +1 -1
- package/dist/packem_shared/{Tus-BlBZykIL.js → Tus-CJBgnJrn.js} +1 -1
- package/dist/packem_shared/{Tus-BBVt2ky3.js → Tus-D9c7KDnl.js} +1 -1
- package/dist/packem_shared/UploadThingMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{UploadThingStorage-BChykYSe.js → UploadThingStorage-DZ4zNvDH.js} +1 -1
- package/dist/packem_shared/VercelBlobMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{VercelBlobStorage-CsRyPfw3.js → VercelBlobStorage-DDNEofR3.js} +1 -1
- package/dist/packem_shared/{approval.d-CMAYH9GF.d.ts → approval.d-C-d-t94D.d.ts} +6 -6
- package/dist/packem_shared/{base-handler-core-D-9Ku1h-.js → base-handler-core-BJP9jHCE.js} +1 -1
- package/dist/packem_shared/{base-handler-fetch-CfkNakv8.js → base-handler-fetch-yrYrukwL.js} +1 -1
- package/dist/packem_shared/base-handler-node-C8P9rkaH.js +1 -0
- package/dist/packem_shared/{createRetryWrapper-CxgiV_hH.js → createRetryWrapper-DgmeHPNF.js} +1 -1
- package/dist/packem_shared/disk-storage-DqnnFQAQ.js +1 -0
- package/dist/packem_shared/disk-storage-with-checksum.d-Dgwyza8a.d.ts +146 -0
- package/dist/packem_shared/{executors.d-BZP2rWo3.d.ts → executors.d-B9dIy3NT.d.ts} +3 -2
- package/dist/packem_shared/files.d-CmSZi3M0.d.ts +655 -0
- package/dist/packem_shared/gcs-meta-storage-C9F78Sqq.js +1 -0
- package/dist/packem_shared/local-meta-storage-BELb1YwO.js +11 -0
- package/dist/packem_shared/{local-meta-storage.d-D9PBfkn6.d.ts → local-meta-storage.d-cRTXr1kb.d.ts} +7 -7
- package/dist/packem_shared/media-transformer.d-C8tn4J2Z.d.ts +331 -0
- package/dist/packem_shared/{memory-storage.d-4EU1cMt1.d.ts → memory-storage.d-BNZvDG1b.d.ts} +32 -40
- package/dist/packem_shared/path-C-OWflAo-_mqb5p5d.js +1 -0
- package/dist/packem_shared/{rest-base-e0reNDE_.js → rest-base-BQ_dhWyV.js} +1 -1
- package/dist/packem_shared/s3-base-storage-CX94H-Za.js +1 -0
- package/dist/packem_shared/{s3-base-storage.d-BQgP5B-t.d.ts → s3-base-storage.d-ks99NSs-.d.ts} +64 -70
- package/dist/packem_shared/storage-DR7qdwBN.js +1 -0
- package/dist/packem_shared/storage.d-DwdJrArF.d.ts +1186 -0
- package/dist/packem_shared/tus-base.d-BKBoJVy0.d.ts +103 -0
- package/dist/packem_shared/types.d-B1_xZIhu.d.ts +104 -0
- package/dist/packem_shared/{types.d-CrUWY4On.d.ts → types.d-BEUv414z.d.ts} +134 -134
- package/dist/packem_shared/{types.d-CggTCgXr.d.ts → types.d-D7Zlz5RE.d.ts} +3 -3
- package/dist/storage/aws/clients/index.d.ts +388 -388
- package/dist/storage/aws/index.d.ts +110 -113
- package/dist/storage/aws/index.js +1 -1
- package/dist/storage/aws-light/index.d.ts +64 -67
- package/dist/storage/aws-light/index.js +1 -1
- package/dist/storage/azure/index.d.ts +134 -139
- package/dist/storage/azure/index.js +1 -1
- package/dist/storage/box/index.d.ts +89 -92
- package/dist/storage/box/index.js +1 -1
- package/dist/storage/bun-s3/index.d.ts +71 -76
- package/dist/storage/bun-s3/index.js +1 -1
- package/dist/storage/bunny/index.d.ts +52 -55
- package/dist/storage/bunny/index.js +1 -1
- package/dist/storage/cloudinary/index.d.ts +54 -59
- package/dist/storage/cloudinary/index.js +1 -1
- package/dist/storage/dropbox/index.d.ts +59 -62
- package/dist/storage/dropbox/index.js +1 -1
- package/dist/storage/firebase/index.d.ts +74 -79
- package/dist/storage/firebase/index.js +1 -1
- package/dist/storage/ftp/index.d.ts +38 -43
- package/dist/storage/ftp/index.js +1 -1
- package/dist/storage/gcs/index.d.ts +90 -95
- package/dist/storage/gcs/index.js +1 -1
- package/dist/storage/google-drive/index.d.ts +69 -72
- package/dist/storage/google-drive/index.js +1 -1
- package/dist/storage/local/index.d.ts +4 -3
- package/dist/storage/local/index.js +1 -1
- package/dist/storage/memory/index.d.ts +3 -2
- package/dist/storage/memory/index.js +1 -1
- package/dist/storage/netlify-blob/index.d.ts +86 -93
- package/dist/storage/netlify-blob/index.js +1 -1
- package/dist/storage/onedrive/index.d.ts +44 -53
- package/dist/storage/onedrive/index.js +1 -1
- package/dist/storage/pocketbase/index.d.ts +67 -72
- package/dist/storage/pocketbase/index.js +1 -1
- package/dist/storage/sftp/index.d.ts +40 -45
- package/dist/storage/sftp/index.js +1 -1
- package/dist/storage/sharepoint/index.d.ts +96 -95
- package/dist/storage/sharepoint/index.js +1 -1
- package/dist/storage/supabase/index.d.ts +50 -55
- package/dist/storage/supabase/index.js +1 -1
- package/dist/storage/uploadthing/index.d.ts +34 -37
- package/dist/storage/uploadthing/index.js +1 -1
- package/dist/storage/vercel-blob/index.d.ts +110 -115
- package/dist/storage/vercel-blob/index.js +1 -1
- package/dist/transformer/audio-transformer.d.ts +97 -96
- package/dist/transformer/image-transformer.d.ts +423 -422
- package/dist/transformer/index.d.ts +35 -34
- package/dist/transformer/video-transformer.d.ts +112 -111
- package/package.json +2 -2
- package/dist/packem_shared/AwsLightStorage-BK-WPL0h.js +0 -1
- package/dist/packem_shared/AzureStorage-1UvDIQZd.js +0 -1
- package/dist/packem_shared/BoxMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/BunS3MetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/BunnyMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/CloudinaryMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/DiskStorage-CI07TVNu.js +0 -1
- package/dist/packem_shared/DropboxMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/FirebaseMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/FtpMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/GoogleDriveMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/NetlifyBlobStorage-CkpCCoN1.js +0 -1
- package/dist/packem_shared/OneDriveMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/PocketBaseMetaStorage-DOTLwVE7.js +0 -1
- package/dist/packem_shared/SftpMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/SharePointMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/SupabaseMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/UploadThingMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/VercelBlobMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/base-handler-node-BF1v1qDa.js +0 -1
- package/dist/packem_shared/disk-storage-CsQcYW3s.js +0 -1
- package/dist/packem_shared/disk-storage-with-checksum.d-B-VGEsfl.d.ts +0 -156
- package/dist/packem_shared/files.d-CH0iLBNC.d.ts +0 -655
- package/dist/packem_shared/gcs-meta-storage-B7BnctnV.js +0 -1
- package/dist/packem_shared/local-meta-storage-iuJnu90B.js +0 -11
- package/dist/packem_shared/media-transformer.d-Quf4ai47.d.ts +0 -331
- package/dist/packem_shared/path-0oTTdkvl-DvWvbDbh.js +0 -1
- package/dist/packem_shared/s3-base-storage-BoTyhuzO.js +0 -1
- package/dist/packem_shared/storage-0j5nCAUp.js +0 -1
- package/dist/packem_shared/storage.d-CEM1upWM.d.ts +0 -1176
- package/dist/packem_shared/tus-base.d-DLzKE54M.d.ts +0 -106
- package/dist/packem_shared/types.d-Bon9GVVe.d.ts +0 -104
|
@@ -1,576 +1,577 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import { F as File, g as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-
|
|
3
|
-
import { I as ImageTransformerConfig, T as TransformResult, R as ResizeOptions, C as CropOptions, g as RotateOptions, h as ImageFormat, i as TransformOptions, S as SharpenOptions, j as BlurOptions, k as MedianOptions, l as CLAHEOptions, m as ConvolveOptions, n as ThresholdOptions, o as BooleanOptions, L as LinearOptions, p as RecombineOptions, q as ModulateOptions, r as TintOptions, G as GreyscaleOptions, s as ColourspaceOptions, E as ExtractChannelOptions, J as JoinChannelOptions, t as BandboolOptions, u as AffineOptions, D as DilateOptions, v as ErodeOptions, P as PipelineColourspaceOptions, w as ToColourspaceOptions, x as RemoveAlphaOptions, y as EnsureAlphaOptions, z as TransformationStep, B as BaseTransformer } from "../packem_shared/types.d-
|
|
2
|
+
import { F as File, g as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-DwdJrArF.js";
|
|
3
|
+
import { I as ImageTransformerConfig, T as TransformResult, R as ResizeOptions, C as CropOptions, g as RotateOptions, h as ImageFormat, i as TransformOptions, S as SharpenOptions, j as BlurOptions, k as MedianOptions, l as CLAHEOptions, m as ConvolveOptions, n as ThresholdOptions, o as BooleanOptions, L as LinearOptions, p as RecombineOptions, q as ModulateOptions, r as TintOptions, G as GreyscaleOptions, s as ColourspaceOptions, E as ExtractChannelOptions, J as JoinChannelOptions, t as BandboolOptions, u as AffineOptions, D as DilateOptions, v as ErodeOptions, P as PipelineColourspaceOptions, w as ToColourspaceOptions, x as RemoveAlphaOptions, y as EnsureAlphaOptions, z as TransformationStep, B as BaseTransformer } from "../packem_shared/types.d-BEUv414z.js";
|
|
4
|
+
import 'node:timers';
|
|
4
5
|
import 'node:crypto';
|
|
5
6
|
import 'node:http';
|
|
6
7
|
import 'lru-cache';
|
|
7
8
|
/**
|
|
8
|
-
* Image transformer that uses storage backends to retrieve and transform images.
|
|
9
|
-
* @template TFile The file type used by this transformer.
|
|
10
|
-
* @template TFileReturn The return type for file retrieval operations.
|
|
11
|
-
*
|
|
12
|
-
* Supports URL-based transformations with query parameters for on-demand image processing.
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const transformer = new ImageTransformer(storage, {
|
|
16
|
-
* maxImageSize: 10 * 1024 * 1024, // 10MB
|
|
17
|
-
* cache: new Map()
|
|
18
|
-
* });
|
|
19
|
-
*
|
|
20
|
-
* // Programmatic usage - resize an image
|
|
21
|
-
* const result = await transformer.resize('image-id', {
|
|
22
|
-
* width: 800,
|
|
23
|
-
* height: 600,
|
|
24
|
-
* fit: 'cover'
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* // URL-based transformations
|
|
28
|
-
* // GET /files/image-id?width=300&height=200&fit=cover&quality=80
|
|
29
|
-
* // GET /files/image-id?width=800&quality=90&lossless=true
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* ## Supported Query Parameters
|
|
33
|
-
*
|
|
34
|
-
* - `width`: Width in pixels (Number)
|
|
35
|
-
* - `height`: Height in pixels (Number)
|
|
36
|
-
* - `fit`: Resize fit mode - cover/contain/fill/inside/outside
|
|
37
|
-
* - `position`: Position for cover/contain fits - center/top/right/bottom/left etc.
|
|
38
|
-
* - `quality`: Quality for JPEG/WebP (0-100)
|
|
39
|
-
* - `lossless`: Use lossless compression for WebP (Boolean)
|
|
40
|
-
* - `effort`: CPU effort for AVIF (0-10, higher = slower but better)
|
|
41
|
-
* - `alphaQuality`: Quality of alpha layer for WebP (0-100)
|
|
42
|
-
* - `loop`: GIF animation iterations, 0 for infinite (Number)
|
|
43
|
-
* - `delay`: GIF delay between frames in milliseconds (Number)
|
|
44
|
-
*/
|
|
9
|
+
* Image transformer that uses storage backends to retrieve and transform images.
|
|
10
|
+
* @template TFile The file type used by this transformer.
|
|
11
|
+
* @template TFileReturn The return type for file retrieval operations.
|
|
12
|
+
*
|
|
13
|
+
* Supports URL-based transformations with query parameters for on-demand image processing.
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const transformer = new ImageTransformer(storage, {
|
|
17
|
+
* maxImageSize: 10 * 1024 * 1024, // 10MB
|
|
18
|
+
* cache: new Map()
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Programmatic usage - resize an image
|
|
22
|
+
* const result = await transformer.resize('image-id', {
|
|
23
|
+
* width: 800,
|
|
24
|
+
* height: 600,
|
|
25
|
+
* fit: 'cover'
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // URL-based transformations
|
|
29
|
+
* // GET /files/image-id?width=300&height=200&fit=cover&quality=80
|
|
30
|
+
* // GET /files/image-id?width=800&quality=90&lossless=true
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* ## Supported Query Parameters
|
|
34
|
+
*
|
|
35
|
+
* - `width`: Width in pixels (Number)
|
|
36
|
+
* - `height`: Height in pixels (Number)
|
|
37
|
+
* - `fit`: Resize fit mode - cover/contain/fill/inside/outside
|
|
38
|
+
* - `position`: Position for cover/contain fits - center/top/right/bottom/left etc.
|
|
39
|
+
* - `quality`: Quality for JPEG/WebP (0-100)
|
|
40
|
+
* - `lossless`: Use lossless compression for WebP (Boolean)
|
|
41
|
+
* - `effort`: CPU effort for AVIF (0-10, higher = slower but better)
|
|
42
|
+
* - `alphaQuality`: Quality of alpha layer for WebP (0-100)
|
|
43
|
+
* - `loop`: GIF animation iterations, 0 for infinite (Number)
|
|
44
|
+
* - `delay`: GIF delay between frames in milliseconds (Number)
|
|
45
|
+
*/
|
|
45
46
|
declare class ImageTransformer<TFile extends File = File, TFileReturn extends FileReturn = FileReturn> extends BaseTransformer<ImageTransformerConfig, TransformResult<TFileReturn>, TFile, TFileReturn> {
|
|
46
47
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
* Creates a new ImageTransformer instance.
|
|
49
|
+
* @param storage The storage backend for retrieving and storing image files.
|
|
50
|
+
* @param config Configuration options for image transformation including cache settings and size limits.
|
|
51
|
+
*/
|
|
51
52
|
constructor(storage: BaseStorage<TFile, TFileReturn>, config?: ImageTransformerConfig);
|
|
52
53
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
* Returns a sharp() invocation that applies the transformer's configured decompression-bomb defenses.
|
|
55
|
+
*/
|
|
55
56
|
private openImage;
|
|
56
57
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
* Resizes an image to specified dimensions with optional fit mode.
|
|
59
|
+
* @param fileId Unique identifier of the image file to resize.
|
|
60
|
+
* @param options Resize options including width, height, and fit mode.
|
|
61
|
+
* @returns Promise resolving to transformed image result.
|
|
62
|
+
*/
|
|
62
63
|
resize(fileId: string, options: ResizeOptions): Promise<TransformResult<TFileReturn>>;
|
|
63
64
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
* Crops an image to the specified region.
|
|
66
|
+
* @param fileId Unique identifier of the image file to crop.
|
|
67
|
+
* @param options Crop options including region coordinates.
|
|
68
|
+
* @returns Promise resolving to transformed image result.
|
|
69
|
+
*/
|
|
69
70
|
crop(fileId: string, options: CropOptions): Promise<TransformResult<TFileReturn>>;
|
|
70
71
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
* Rotates an image by the specified angle.
|
|
73
|
+
* @param fileId Unique identifier of the image file to rotate.
|
|
74
|
+
* @param options Rotate options including angle.
|
|
75
|
+
* @returns Promise resolving to transformed image result.
|
|
76
|
+
*/
|
|
76
77
|
rotate(fileId: string, options: RotateOptions): Promise<TransformResult<TFileReturn>>;
|
|
77
78
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
* Converts an image to the specified format.
|
|
80
|
+
* @param fileId Unique identifier of the image file to convert.
|
|
81
|
+
* @param format Target image format (e.g., "jpeg", "png", "webp").
|
|
82
|
+
* @param options Additional transform options.
|
|
83
|
+
* @returns Promise resolving to transformed image result.
|
|
84
|
+
*/
|
|
84
85
|
convertFormat(fileId: string, format: ImageFormat, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
85
86
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
* Applies sharpening filter to an image.
|
|
88
|
+
* @param fileId Unique identifier of the image file to sharpen.
|
|
89
|
+
* @param options Sharpen options including sigma and flat/jagged threshold.
|
|
90
|
+
* @returns Promise resolving to transformed image result.
|
|
91
|
+
*/
|
|
91
92
|
sharpen(fileId: string, options?: SharpenOptions): Promise<TransformResult<TFileReturn>>;
|
|
92
93
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
* Applies blurring filter to an image.
|
|
95
|
+
* @param fileId Unique identifier of the image file to blur.
|
|
96
|
+
* @param options Blur options including sigma.
|
|
97
|
+
* @returns Promise resolving to transformed image result.
|
|
98
|
+
*/
|
|
98
99
|
blur(fileId: string, options?: BlurOptions): Promise<TransformResult<TFileReturn>>;
|
|
99
100
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
* Applies median filter to an image for noise reduction.
|
|
102
|
+
* @param fileId Unique identifier of the image file to process.
|
|
103
|
+
* @param options Median filter options including radius.
|
|
104
|
+
* @returns Promise resolving to transformed image result.
|
|
105
|
+
*/
|
|
105
106
|
median(fileId: string, options?: MedianOptions): Promise<TransformResult<TFileReturn>>;
|
|
106
107
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
* Applies CLAHE (Contrast Limited Adaptive Histogram Equalization) to an image.
|
|
109
|
+
* @param fileId Unique identifier of the image file to process.
|
|
110
|
+
* @param options CLAHE options including width, height, and maxSlope.
|
|
111
|
+
* @returns Promise resolving to transformed image result.
|
|
112
|
+
*/
|
|
112
113
|
clahe(fileId: string, options?: CLAHEOptions): Promise<TransformResult<TFileReturn>>;
|
|
113
114
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
* Applies convolution kernel to an image.
|
|
116
|
+
* @param fileId Unique identifier of the image file to process.
|
|
117
|
+
* @param options Convolve options including kernel matrix.
|
|
118
|
+
* @returns Promise resolving to transformed image result.
|
|
119
|
+
*/
|
|
119
120
|
convolve(fileId: string, options: ConvolveOptions): Promise<TransformResult<TFileReturn>>;
|
|
120
121
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
* Applies thresholding to an image to create a binary image.
|
|
123
|
+
* @param fileId Unique identifier of the image file to process.
|
|
124
|
+
* @param options Threshold options including threshold value.
|
|
125
|
+
* @returns Promise resolving to transformed image result.
|
|
126
|
+
*/
|
|
126
127
|
threshold(fileId: string, options?: ThresholdOptions): Promise<TransformResult<TFileReturn>>;
|
|
127
128
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
* Applies boolean operation to an image.
|
|
130
|
+
* @param fileId Unique identifier of the image file to process.
|
|
131
|
+
* @param options Boolean operation options including operator and operand.
|
|
132
|
+
* @returns Promise resolving to transformed image result.
|
|
133
|
+
*/
|
|
133
134
|
boolean(fileId: string, options: BooleanOptions): Promise<TransformResult<TFileReturn>>;
|
|
134
135
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
* Applies linear transformation to an image.
|
|
137
|
+
* @param fileId Unique identifier of the image file to process.
|
|
138
|
+
* @param options Linear transformation options including a and b coefficients.
|
|
139
|
+
* @returns Promise resolving to transformed image result.
|
|
140
|
+
*/
|
|
140
141
|
linear(fileId: string, options: LinearOptions): Promise<TransformResult<TFileReturn>>;
|
|
141
142
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
* Applies recombine transformation to an image using a matrix.
|
|
144
|
+
* @param fileId Unique identifier of the image file to process.
|
|
145
|
+
* @param options Recombine options including matrix coefficients.
|
|
146
|
+
* @returns Promise resolving to transformed image result.
|
|
147
|
+
*/
|
|
147
148
|
recombine(fileId: string, options: RecombineOptions): Promise<TransformResult<TFileReturn>>;
|
|
148
149
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
* Applies modulation (brightness, saturation, hue) to an image.
|
|
151
|
+
* @param fileId Unique identifier of the image file to process.
|
|
152
|
+
* @param options Modulate options including brightness, saturation, and hue.
|
|
153
|
+
* @returns Promise resolving to transformed image result.
|
|
154
|
+
*/
|
|
154
155
|
modulate(fileId: string, options: ModulateOptions): Promise<TransformResult<TFileReturn>>;
|
|
155
156
|
/**
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
* Applies tinting to an image.
|
|
158
|
+
* @param fileId Unique identifier of the image file to process.
|
|
159
|
+
* @param options Tint options including RGB color values.
|
|
160
|
+
* @returns Promise resolving to transformed image result.
|
|
161
|
+
*/
|
|
161
162
|
tint(fileId: string, options: TintOptions): Promise<TransformResult<TFileReturn>>;
|
|
162
163
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
* Converts an image to greyscale.
|
|
165
|
+
* @param fileId Unique identifier of the image file to convert.
|
|
166
|
+
* @param options Greyscale conversion options.
|
|
167
|
+
* @returns Promise resolving to transformed image result.
|
|
168
|
+
*/
|
|
168
169
|
greyscale(fileId: string, options?: GreyscaleOptions): Promise<TransformResult<TFileReturn>>;
|
|
169
170
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
* Converts an image to a different colourspace.
|
|
172
|
+
* @param fileId Unique identifier of the image file to convert.
|
|
173
|
+
* @param options Colourspace conversion options including target colourspace.
|
|
174
|
+
* @returns Promise resolving to transformed image result.
|
|
175
|
+
*/
|
|
175
176
|
colourspace(fileId: string, options: ColourspaceOptions): Promise<TransformResult<TFileReturn>>;
|
|
176
177
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
* Extracts a specific channel from an image.
|
|
179
|
+
* @param fileId Unique identifier of the image file to process.
|
|
180
|
+
* @param options Extract channel options including channel index.
|
|
181
|
+
* @returns Promise resolving to transformed image result.
|
|
182
|
+
*/
|
|
182
183
|
extractChannel(fileId: string, options: ExtractChannelOptions): Promise<TransformResult<TFileReturn>>;
|
|
183
184
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
* Joins channels to an image.
|
|
186
|
+
* @param fileId Unique identifier of the image file to process.
|
|
187
|
+
* @param options Join channel options including channel sources.
|
|
188
|
+
* @returns Promise resolving to transformed image result.
|
|
189
|
+
*/
|
|
189
190
|
joinChannel(fileId: string, options: JoinChannelOptions): Promise<TransformResult<TFileReturn>>;
|
|
190
191
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
* Applies band boolean operation to an image.
|
|
193
|
+
* @param fileId Unique identifier of the image file to process.
|
|
194
|
+
* @param options Band boolean options including operator.
|
|
195
|
+
* @returns Promise resolving to transformed image result.
|
|
196
|
+
*/
|
|
196
197
|
bandbool(fileId: string, options: BandboolOptions): Promise<TransformResult<TFileReturn>>;
|
|
197
198
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
* Auto-orients an image based on EXIF orientation data.
|
|
200
|
+
* @param fileId Unique identifier of the image file to orient.
|
|
201
|
+
* @param options Additional transform options.
|
|
202
|
+
* @returns Promise resolving to transformed image result.
|
|
203
|
+
*/
|
|
203
204
|
autoOrient(fileId: string, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
204
205
|
/**
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
* Flips an image vertically.
|
|
207
|
+
* @param fileId Unique identifier of the image file to flip.
|
|
208
|
+
* @param options Additional transform options.
|
|
209
|
+
* @returns Promise resolving to transformed image result.
|
|
210
|
+
*/
|
|
210
211
|
flip(fileId: string, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
211
212
|
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
* Flops an image horizontally.
|
|
214
|
+
* @param fileId Unique identifier of the image file to flop.
|
|
215
|
+
* @param options Additional transform options.
|
|
216
|
+
* @returns Promise resolving to transformed image result.
|
|
217
|
+
*/
|
|
217
218
|
flop(fileId: string, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
218
219
|
/**
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
220
|
+
* Flattens an image alpha channel onto a background color.
|
|
221
|
+
* @param fileId Unique identifier of the image file to flatten.
|
|
222
|
+
* @param options Additional transform options.
|
|
223
|
+
* @returns Promise resolving to transformed image result.
|
|
224
|
+
*/
|
|
224
225
|
flatten(fileId: string, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
225
226
|
/**
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
* Unflattens an image alpha channel.
|
|
228
|
+
* @param fileId Unique identifier of the image file to unflatten.
|
|
229
|
+
* @param options Additional transform options.
|
|
230
|
+
* @returns Promise resolving to transformed image result.
|
|
231
|
+
*/
|
|
231
232
|
unflatten(fileId: string, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
232
233
|
/**
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
* Applies gamma correction to an image.
|
|
235
|
+
* @param fileId Unique identifier of the image file to process.
|
|
236
|
+
* @param options Additional transform options.
|
|
237
|
+
* @returns Promise resolving to transformed image result.
|
|
238
|
+
*/
|
|
238
239
|
gamma(fileId: string, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
239
240
|
/**
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
* Negates (inverts) an image.
|
|
242
|
+
* @param fileId Unique identifier of the image file to negate.
|
|
243
|
+
* @param options Additional transform options.
|
|
244
|
+
* @returns Promise resolving to transformed image result.
|
|
245
|
+
*/
|
|
245
246
|
negate(fileId: string, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
246
247
|
/**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
* Normalises an image by enhancing contrast.
|
|
249
|
+
* @param fileId Unique identifier of the image file to normalise.
|
|
250
|
+
* @param options Additional transform options.
|
|
251
|
+
* @returns Promise resolving to transformed image result.
|
|
252
|
+
*/
|
|
252
253
|
normalise(fileId: string, options?: TransformOptions): Promise<TransformResult<TFileReturn>>;
|
|
253
254
|
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
* Applies affine transformation to an image.
|
|
256
|
+
* @param fileId Unique identifier of the image file to transform.
|
|
257
|
+
* @param options Affine transformation options including matrix.
|
|
258
|
+
* @returns Promise resolving to transformed image result.
|
|
259
|
+
*/
|
|
259
260
|
affine(fileId: string, options: AffineOptions): Promise<TransformResult<TFileReturn>>;
|
|
260
261
|
/**
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
* Applies dilation (morphological operation) to an image.
|
|
263
|
+
* @param fileId Unique identifier of the image file to process.
|
|
264
|
+
* @param options Dilate options including iterations.
|
|
265
|
+
* @returns Promise resolving to transformed image result.
|
|
266
|
+
*/
|
|
266
267
|
dilate(fileId: string, options?: DilateOptions): Promise<TransformResult<TFileReturn>>;
|
|
267
268
|
/**
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
* Applies erosion (morphological operation) to an image.
|
|
270
|
+
* @param fileId Unique identifier of the image file to process.
|
|
271
|
+
* @param options Erode options including iterations.
|
|
272
|
+
* @returns Promise resolving to transformed image result.
|
|
273
|
+
*/
|
|
273
274
|
erode(fileId: string, options?: ErodeOptions): Promise<TransformResult<TFileReturn>>;
|
|
274
275
|
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
276
|
+
* Sets pipeline colourspace for an image.
|
|
277
|
+
* @param fileId Unique identifier of the image file to process.
|
|
278
|
+
* @param options Pipeline colourspace options including colourspace.
|
|
279
|
+
* @returns Promise resolving to transformed image result.
|
|
280
|
+
*/
|
|
280
281
|
pipelineColourspace(fileId: string, options: PipelineColourspaceOptions): Promise<TransformResult<TFileReturn>>;
|
|
281
282
|
/**
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
* Converts colourspace of an image.
|
|
284
|
+
* @param fileId Unique identifier of the image file to convert.
|
|
285
|
+
* @param options ToColourspace options including target colourspace.
|
|
286
|
+
* @returns Promise resolving to transformed image result.
|
|
287
|
+
*/
|
|
287
288
|
toColourspace(fileId: string, options: ToColourspaceOptions): Promise<TransformResult<TFileReturn>>;
|
|
288
289
|
/**
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
* Removes alpha channel from an image.
|
|
291
|
+
* @param fileId Unique identifier of the image file to process.
|
|
292
|
+
* @param options RemoveAlpha transformation options.
|
|
293
|
+
* @returns Promise resolving to transformed image result.
|
|
294
|
+
*/
|
|
294
295
|
removeAlpha(fileId: string, options?: RemoveAlphaOptions): Promise<TransformResult<TFileReturn>>;
|
|
295
296
|
/**
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
* Ensures alpha channel exists in an image.
|
|
298
|
+
* @param fileId Unique identifier of the image file to process.
|
|
299
|
+
* @param options EnsureAlpha transformation options.
|
|
300
|
+
* @returns Promise resolving to transformed image result.
|
|
301
|
+
*/
|
|
301
302
|
ensureAlpha(fileId: string, options?: EnsureAlphaOptions): Promise<TransformResult<TFileReturn>>;
|
|
302
303
|
/**
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
* Applies a custom transformation pipeline to an image.
|
|
305
|
+
* @param fileId Unique identifier of the image file to transform.
|
|
306
|
+
* @param steps Array of transformation steps to apply in sequence.
|
|
307
|
+
* @returns Promise resolving to transformed image result.
|
|
308
|
+
*/
|
|
308
309
|
transform(fileId: string, steps: TransformationStep[]): Promise<TransformResult<TFileReturn>>;
|
|
309
310
|
/**
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
311
|
+
* Streams transform of a file (for large files, falls back to regular transform).
|
|
312
|
+
* @param fileId Unique identifier of the image file to transform.
|
|
313
|
+
* @param steps Array of transformation steps to apply in sequence.
|
|
314
|
+
* @returns Promise resolving to stream with headers and size information.
|
|
315
|
+
*/
|
|
315
316
|
override transformStream(fileId: string, steps: TransformationStep[]): Promise<{
|
|
316
317
|
headers?: Record<string, string>;
|
|
317
318
|
size?: number;
|
|
318
319
|
stream: Readable;
|
|
319
320
|
}>;
|
|
320
321
|
/**
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
322
|
+
* Applies multiple transformations in sequence using Sharp.
|
|
323
|
+
* @param buffer The original image buffer.
|
|
324
|
+
* @param steps Array of transformation steps to apply.
|
|
325
|
+
* @returns Promise resolving to transformed image buffer.
|
|
326
|
+
* @private
|
|
327
|
+
*/
|
|
327
328
|
private applyTransformations;
|
|
328
329
|
/**
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
330
|
+
* Applies resize transformation using Sharp.
|
|
331
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
332
|
+
* @param options Resize transformation options.
|
|
333
|
+
* @returns Modified Sharp instance with resize applied.
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
335
336
|
private applyResize;
|
|
336
337
|
/**
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
338
|
+
* Applies crop transformation using Sharp.
|
|
339
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
340
|
+
* @param options Crop transformation options.
|
|
341
|
+
* @returns Modified Sharp instance with crop applied.
|
|
342
|
+
* @private
|
|
343
|
+
*/
|
|
343
344
|
private applyCrop;
|
|
344
345
|
/**
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
346
|
+
* Applies rotate transformation using Sharp.
|
|
347
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
348
|
+
* @param options Rotate transformation options.
|
|
349
|
+
* @returns Modified Sharp instance with rotation applied.
|
|
350
|
+
* @private
|
|
351
|
+
*/
|
|
351
352
|
private applyRotate;
|
|
352
353
|
/**
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
354
|
+
* Applies sharpen transformation using Sharp.
|
|
355
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
356
|
+
* @param options Sharpen transformation options.
|
|
357
|
+
* @returns Modified Sharp instance with sharpening applied.
|
|
358
|
+
* @private
|
|
359
|
+
*/
|
|
359
360
|
private applySharpen;
|
|
360
361
|
/**
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
362
|
+
* Applies blur transformation using Sharp.
|
|
363
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
364
|
+
* @param options Blur transformation options.
|
|
365
|
+
* @returns Modified Sharp instance with blurring applied.
|
|
366
|
+
* @private
|
|
367
|
+
*/
|
|
367
368
|
private applyBlur;
|
|
368
369
|
/**
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
370
|
+
* Applies median filter using Sharp.
|
|
371
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
372
|
+
* @param options Median transformation options.
|
|
373
|
+
* @returns Modified Sharp instance with median filter applied.
|
|
374
|
+
* @private
|
|
375
|
+
*/
|
|
375
376
|
private applyMedian;
|
|
376
377
|
/**
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
378
|
+
* Applies CLAHE (Contrast Limited Adaptive Histogram Equalization) using Sharp.
|
|
379
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
380
|
+
* @param options CLAHE transformation options.
|
|
381
|
+
* @returns Modified Sharp instance with CLAHE applied.
|
|
382
|
+
* @private
|
|
383
|
+
*/
|
|
383
384
|
private applyCLAHE;
|
|
384
385
|
/**
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
386
|
+
* Applies convolution using Sharp.
|
|
387
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
388
|
+
* @param options Convolution transformation options.
|
|
389
|
+
* @returns Modified Sharp instance with convolution applied.
|
|
390
|
+
* @private
|
|
391
|
+
*/
|
|
391
392
|
private applyConvolve;
|
|
392
393
|
/**
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
394
|
+
* Applies threshold using Sharp.
|
|
395
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
396
|
+
* @param options Threshold transformation options.
|
|
397
|
+
* @returns Modified Sharp instance with thresholding applied.
|
|
398
|
+
* @private
|
|
399
|
+
*/
|
|
399
400
|
private applyThreshold;
|
|
400
401
|
/**
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
402
|
+
* Applies boolean operation using Sharp.
|
|
403
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
404
|
+
* @param options Boolean operation options.
|
|
405
|
+
* @returns Modified Sharp instance with boolean operation applied.
|
|
406
|
+
* @private
|
|
407
|
+
*/
|
|
407
408
|
private applyBoolean;
|
|
408
409
|
/**
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
410
|
+
* Applies linear transformation using Sharp.
|
|
411
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
412
|
+
* @param options Linear transformation options.
|
|
413
|
+
* @returns Modified Sharp instance with linear transformation applied.
|
|
414
|
+
* @private
|
|
415
|
+
*/
|
|
415
416
|
private applyLinear;
|
|
416
417
|
/**
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
418
|
+
* Applies recombine transformation using Sharp.
|
|
419
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
420
|
+
* @param options Recombine transformation options.
|
|
421
|
+
* @returns Modified Sharp instance with recombine applied.
|
|
422
|
+
* @private
|
|
423
|
+
*/
|
|
423
424
|
private applyRecombine;
|
|
424
425
|
/**
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
426
|
+
* Applies modulate transformation using Sharp.
|
|
427
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
428
|
+
* @param options Modulate transformation options.
|
|
429
|
+
* @returns Modified Sharp instance with modulation applied.
|
|
430
|
+
* @private
|
|
431
|
+
*/
|
|
431
432
|
private applyModulate;
|
|
432
433
|
/**
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
434
|
+
* Applies tint using Sharp.
|
|
435
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
436
|
+
* @param options Tint transformation options.
|
|
437
|
+
* @returns Modified Sharp instance with tinting applied.
|
|
438
|
+
* @private
|
|
439
|
+
*/
|
|
439
440
|
private applyTint;
|
|
440
441
|
/**
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
442
|
+
* Applies greyscale conversion using Sharp.
|
|
443
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
444
|
+
* @param options Greyscale transformation options.
|
|
445
|
+
* @returns Modified Sharp instance converted to greyscale.
|
|
446
|
+
* @private
|
|
447
|
+
*/
|
|
447
448
|
private applyGreyscale;
|
|
448
449
|
/**
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
450
|
+
* Applies colourspace conversion using Sharp.
|
|
451
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
452
|
+
* @param options Colourspace transformation options.
|
|
453
|
+
* @returns Modified Sharp instance with colourspace conversion.
|
|
454
|
+
* @private
|
|
455
|
+
*/
|
|
455
456
|
private applyColourspace;
|
|
456
457
|
/**
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
458
|
+
* Extracts channel using Sharp.
|
|
459
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
460
|
+
* @param options Channel extraction options including channel index.
|
|
461
|
+
* @returns Modified Sharp instance with channel extracted.
|
|
462
|
+
* @private
|
|
463
|
+
*/
|
|
463
464
|
private applyExtractChannel;
|
|
464
465
|
/**
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
466
|
+
* Joins channels using Sharp.
|
|
467
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
468
|
+
* @param options Channel joining options including image sources.
|
|
469
|
+
* @returns Modified Sharp instance with channels joined.
|
|
470
|
+
* @private
|
|
471
|
+
*/
|
|
471
472
|
private applyJoinChannel;
|
|
472
473
|
/**
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
474
|
+
* Applies band boolean operation using Sharp.
|
|
475
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
476
|
+
* @param options Band boolean options including operator.
|
|
477
|
+
* @returns Modified Sharp instance with band boolean operation applied.
|
|
478
|
+
* @private
|
|
479
|
+
*/
|
|
479
480
|
private applyBandbool;
|
|
480
481
|
/**
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
482
|
+
* Applies affine transformation using Sharp.
|
|
483
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
484
|
+
* @param options Affine transformation options including matrix.
|
|
485
|
+
* @returns Modified Sharp instance with affine transformation applied.
|
|
486
|
+
* @private
|
|
487
|
+
*/
|
|
487
488
|
private applyAffine;
|
|
488
489
|
/**
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
490
|
+
* Applies dilation using Sharp.
|
|
491
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
492
|
+
* @param options Dilate options including kernel size.
|
|
493
|
+
* @returns Modified Sharp instance with dilation applied.
|
|
494
|
+
* @private
|
|
495
|
+
*/
|
|
495
496
|
private applyDilate;
|
|
496
497
|
/**
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
498
|
+
* Applies erosion using Sharp.
|
|
499
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
500
|
+
* @param options Erode options including kernel size.
|
|
501
|
+
* @returns Modified Sharp instance with erosion applied.
|
|
502
|
+
* @private
|
|
503
|
+
*/
|
|
503
504
|
private applyErode;
|
|
504
505
|
/**
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
506
|
+
* Applies pipeline colourspace using Sharp.
|
|
507
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
508
|
+
* @param options Pipeline colourspace options including target colourspace.
|
|
509
|
+
* @returns Modified Sharp instance with pipeline colourspace applied.
|
|
510
|
+
* @private
|
|
511
|
+
*/
|
|
511
512
|
private applyPipelineColourspace;
|
|
512
513
|
/**
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
514
|
+
* Applies to colourspace conversion using Sharp.
|
|
515
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
516
|
+
* @param options To colourspace options including target colourspace.
|
|
517
|
+
* @returns Modified Sharp instance with colourspace conversion applied.
|
|
518
|
+
* @private
|
|
519
|
+
*/
|
|
519
520
|
private applyToColourspace;
|
|
520
521
|
/**
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
522
|
+
* Applies remove alpha using Sharp.
|
|
523
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
524
|
+
* @param options Remove alpha transformation options.
|
|
525
|
+
* @returns Modified Sharp instance with alpha channel removed.
|
|
526
|
+
* @private
|
|
527
|
+
*/
|
|
527
528
|
private applyRemoveAlpha;
|
|
528
529
|
/**
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
530
|
+
* Applies ensure alpha using Sharp.
|
|
531
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
532
|
+
* @param options Ensure alpha transformation options.
|
|
533
|
+
* @returns Modified Sharp instance with alpha channel ensured.
|
|
534
|
+
* @private
|
|
535
|
+
*/
|
|
535
536
|
private applyEnsureAlpha;
|
|
536
537
|
/**
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
538
|
+
* Applies format and quality transformation using Sharp.
|
|
539
|
+
* @param sharpInstance The Sharp instance to modify.
|
|
540
|
+
* @param options Format and quality transformation options.
|
|
541
|
+
* @returns Modified Sharp instance with format and quality settings applied.
|
|
542
|
+
* @private
|
|
543
|
+
*/
|
|
543
544
|
private applyFormatAndQuality;
|
|
544
545
|
/**
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
546
|
+
* Gets format-specific options for Sharp.
|
|
547
|
+
* @param options Transform options containing format-specific settings.
|
|
548
|
+
* @returns Record of format options for Sharp processing.
|
|
549
|
+
* @private
|
|
550
|
+
*/
|
|
550
551
|
private getFormatOptions;
|
|
551
552
|
/**
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
553
|
+
* Validates that the file is a supported image.
|
|
554
|
+
* @param file The file to validate.
|
|
555
|
+
* @returns Promise that resolves if validation passes.
|
|
556
|
+
* @throws Error if file size exceeds limits, wrong content type, unsupported format, or invalid image.
|
|
557
|
+
* @private
|
|
558
|
+
*/
|
|
558
559
|
private validateImage;
|
|
559
560
|
/**
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
561
|
+
* Creates transformation result with metadata.
|
|
562
|
+
* @param buffer The transformed image buffer.
|
|
563
|
+
* @param originalFile The original file information.
|
|
564
|
+
* @returns Image transformation result with metadata.
|
|
565
|
+
* @private
|
|
566
|
+
*/
|
|
566
567
|
private createTransformResult;
|
|
567
568
|
/**
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
* Generates cache key for transformation.
|
|
570
|
+
* @param fileId The file identifier.
|
|
571
|
+
* @param steps Array of transformation steps.
|
|
572
|
+
* @returns Unique cache key string.
|
|
573
|
+
* @private
|
|
574
|
+
*/
|
|
574
575
|
private generateCacheKey;
|
|
575
576
|
}
|
|
576
577
|
export { ImageTransformer as default };
|