FaceCompressor.compressWebpFromDetectedFace Method¶
Module: FaceCompressor
Definition¶
Crops an already detected face using a tighter, eye-distance-based face placement (different from the Bioseal portrait used by compress_ai_from_detected_face), resizes the crop to the given output size, and compresses it to WebP so that its size does not exceed the given byte budget.
Unlike compress_webp, no face detection is performed: the caller provides the face, which avoids running the FaceDetector model a second time when it has already been run on the image.
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. No model needs to be loaded to use this function, since the standard WebP codec is used directly.
Uint8List compressWebpFromDetectedFace(Image image, DetectedFace detectedFace, int outputWidth, int outputHeight, int byteBudget, double eyeImageWidthRatio, double eyeImageHeightRatio, double imageRatio)
Parameters
image ImagedetectedFace DetectedFaceoutputWidth intoutputHeight intbyteBudget inteyeImageWidthRatio doubleeyeImageHeightRatio doubleimageRatio doubleReturns
Uint8ListExceptions