compressImage
Requires:
BaseKit≥3.14.2@ray-js/ray≥1.5.30
Platforms:
iOSAndroid
Method signature
compressImage(params: )Minimum SDK versions
- iOS
ThingSmartBaseKitBizBundle - ≥ 6.0.3
- Android
com.thingclips.smart:thingsmart-bizbundle-basekit - ≥ 6.0.0
Description
Compress images
Parameters
| Property | Type | Required | Description | BaseKit Since | Minimum SDK versions |
|---|---|---|---|---|---|
fileList | string[] | No | List of image paths to compress | - | — |
dstWidth | number | Yes | Target width for compression | - | — |
dstHeight | number | Yes | Target height for compression | - | — |
format | number | No | Output type for compression 0 for jpg, 1 for png, 10 for mp4; default is 0 | v3.20.2 |
|
imageSize | number | No | Target file size after compression, in bytes; e.g., 1 KB = 1024. If the target size cannot be met, compress to the closest possible size. Default: 1 MB (1024*1024) | v3.21.0 |
|
complete | () => void | No | Completion callback (executed on both success and failure) | - | — |
success | (params: Object) => void | No | Callback on successful API call | - | — |
fail | (params: Object) => void | No | Failure callback | - | — |
success callback parameters
| Property | Type | Description | Minimum SDK versions |
|---|---|---|---|
fileList | string[] | List of file paths after compression | — |
fail callback parameters
| Property | Type | Description |
|---|---|---|
errorMsg | string | Error message |
errorCode | string | number | Error code |
| Error extension |
Return Value
None