-
public final class WebPEncoderThe WebPEncoder class provides functionality for encoding images to the WebP format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classWebPEncoder.Companion
-
Constructor Summary
Constructors Constructor Description WebPEncoder(Integer width, Integer height)
-
Method Summary
Modifier and Type Method Description final BooleanaddProgressListener(WebPEncoderProgressListener listener)Adds a progress listener to receive encoding progress updates. final BooleanremoveProgressListener(WebPEncoderProgressListener listener)Removes a progress listener to stop receiving encoding progress updates. final WebPEncoderconfigure(WebPConfig config, WebPPreset preset)Configures the WebP encoder. final WebPEncoderencode(Context context, Uri srcUri, Uri dstUri)Encodes an image file from the given source Uri and saves the result to the specified destination Uri. final WebPEncoderencode(Context context, Bitmap srcBitmap, Uri dstUri)Encodes a Bitmap image and saves the result to the specified destination Uri. final Unitcancel()Cancels the ongoing encoding process. final Unitrelease()Releases the resources associated with the WebPEncoder instance. -
-
Method Detail
-
addProgressListener
final Boolean addProgressListener(WebPEncoderProgressListener listener)
Adds a progress listener to receive encoding progress updates.
- Parameters:
listener- The progress listener to add.
-
removeProgressListener
final Boolean removeProgressListener(WebPEncoderProgressListener listener)
Removes a progress listener to stop receiving encoding progress updates.
- Parameters:
listener- The progress listener to remove.
-
configure
final WebPEncoder configure(WebPConfig config, WebPPreset preset)
Configures the WebP encoder.
- Parameters:
config- The WebP configuration object.preset- The optional WebP preset configuration.
-
encode
final WebPEncoder encode(Context context, Uri srcUri, Uri dstUri)
-
encode
final WebPEncoder encode(Context context, Bitmap srcBitmap, Uri dstUri)
-
release
final Unit release()
Releases the resources associated with the WebPEncoder instance.
-
-
-
-