FaceCompressor.compressWebp Method¶
Module: FaceCompressor
Definition¶
Detects the largest face in an image, crops it using a tighter, eye-distance-based face placement (different from the Bioseal portrait used by compress_ai), resizes the crop to the given output size, and compresses it to WebP so that its size does not exceed the given byte budget.
The WebP quality is searched automatically to find the highest quality whose encoded size fits within byte_budget. If even the lowest quality does not fit, the function fails and no data is returned.
Important
The input image must be in 24-bit BGR format. Loading a FaceDetector model is required to use this function. Unlike compress_ai, no compression model needs to be loaded since the standard WebP codec is used directly.
Uint8List compressWebp(Image image, int outputWidth, int outputHeight, int byteBudget, double eyeImageWidthRatio, double eyeImageHeightRatio, double imageRatio)
Parameters
image ImageoutputWidth intoutputHeight intbyteBudget inteyeImageWidthRatio doubleeyeImageHeightRatio doubleimageRatio doubleReturns
Uint8ListExceptions