Skip to main content
Use this API to reduce the file size of an image.

Parameters

PropertyTypeRequiredDescription
apFilePathsArrayYesArray of image paths to compress
compressLevelNumberNoCompression level (0-4, default: 4)
successFunctionNoCallback with compressed paths
failFunctionNoCallback on failure
completeFunctionNoCallback that always executes

Success Callback

PropertyTypeDescription
apFilePathsArrayPaths to compressed images

Code Example

my.compressImage({
  apFilePaths: ['/local/path/image.jpg'],
  compressLevel: 2,
  success: (res) => {
    console.log('Compressed:', res.apFilePaths);
  }
});