Simple video and image compression tool for Android – Yuanlai’s Wonderful Blog – CSDN Blog

Simple video and image compression tool for Android – Yuanlai’s Wonderful Blog – CSDN Blog

Home Needs a Zip Kit

1.Gradle

implementation 'com.iceteck.silicompressorr:silicompressor:2.2.3'

2. Add relevant permissions (the mobile phone has dynamic application permissions)

3. use

It is very simple to use, directly call the relevant method to pass in the file path to get the path of the new file after compression

<1> Video compression (need to be used in sub-threads)

Compress the video file and return the file path of the new video (parameters are passed in to the original video videoPath and the folder where the compressed destinationDirectory is stored, and the absolute path of the compressed image is returned). The outWidth width outHeight height of the horizontal screen video, the higher the bitrate (code rate), the larger the data, the larger the volume, generally 450000

String filePath=SiliCompressor.with(Context).compressVideo(videoPath, destinationDirectory,outWidth,outHeight,bitrate);

String filePath=SiliCompressor.with(Context).compressVideo(videoPath, destinationDirectory);默认

<2> Image Compression

Compresses an image and returns the file path of the new image

String filePath=SiliCompressor.with(Context).compress(imagePath, destinationDirectory);

Compresses an image and returns the file path of the new image when the source image is deleted

String filePath=SiliCompressor.with(Context).compress(imagePath, destinationDirectory,true);

Compresses the image drawable and returns the file path of the new image

String filePath=SiliCompressor.with(Context).compress(R.drawable.icon);

Compresses an image and returns the bitmap data for the new image

Bitmap imageBitmap=SiliCompressor.with(Context).getCompressBitmap(imagePath);

Compresses an image and returns the bitmap data for the new image while deleting the source image

Bitmap imageBitmap=SiliCompressor.with(Context).getCompressBitmap(imagePath,true)

Well, let’s record it here first!

Read more:  [البث المباشر!] Al Wakra Navbahor Watch the live broadcast online | Group
Facebook
Twitter
LinkedIn
Pinterest
Pocket
WhatsApp

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.