# wx.compressImage(Object object)

Start from base library version 2.4.0. Please remaining backward compatible.

with Promise style call: Supported

Mini Program plugin: Support, need to Mini Program base library version no less than 2.12.0

Compression image interface, optional compression quality

# parameter

# Object object

attribute type Default values Required Introductions
src string yes Picture path, the path of the picture, support local path, code package path
quality number 80 no Compression mass, range 0100, the smaller the value, the lower the mass, and the higher the compression rate (valid only for jpg).
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# object.success callback

# parameter
# Object res
attribute type Introductions
tempFilePath string Temporary file path of compressed image (Local path)

# sample code

wx.compressImage({
  src: '', // Picture path
  quality: 80 // Compression mass
})