Last updated:
0 purchases
kecilin mediacompress
Kecilin Mediacompress #
Kecilin Mediacompress.
Installation #
Step 1
dependencies:
kecilin_mediacompress: <latest_version>
copied to clipboard
or run this command :
flutter pub add kecilin_mediacompress
copied to clipboard
import the package in your code:
import 'package:kecilin_mediacompress/kecilin_mediacompress.dart';
copied to clipboard
Step 2
Add token to gradle.properties
authToken = AUTHENTICATION_TOKEN
copied to clipboard
Step 3
Then use authToken as username in your build.gradle (root project)
allprojects {
repositories {
...
maven {
url "https://jitpack.io"
credentials { username authToken }
}
}
}
copied to clipboard
Step 4
Add authKecilin to manifest android
<application>
<meta-data
android:name="id.kecilin.mediacompress.AUTH_KECILIN"
android:value="AUTH_KECILIN" />
<activity>
...
<activity/>
</application>
copied to clipboard
Usage #
Image #
Image Compress
Compress Image input File and result as File
Future<File> compressAndGetFile(File file) async{
final option = CompressOption()
option.outputType = OutputType.file;
final ResultImageCompress result = await KecilinMediacompress.compressImageWithFile(file: file,option: option);
result.resultPath;
return File(result.resultPath);
}
copied to clipboard
Compress Image input Uint8List and result as File
Future<File> compressUint8AndGetFile(Uint8List uint8List) async{
final option = CompressOption()
option.outputType = OutputType.file;
final ResultImageCompress result = await KecilinMediacompress.compressImageWithUint8(uint8List: uint8List,option: option);
result.resultPath;
return File(result.resultPath);
}
copied to clipboard
API #
ResultImageCompress
Result ImageCompress is a class used to receive the results of image compression. It contains several variables.
class ResultImageCompress {
//result compress based on method you choose
String resultPath ="";
Uint8List? resultUint8List;
//info duration compress
String formattedDuration = "";
double durationInMillisSeconds =0.0;
//info size compress
double originalSizeInBytes = 0.0;
String formattedOriginalSize = "";
double compressedSizeInBytes = 0.0;
String formattedCompressedSize = "";
}
copied to clipboard
CompressOption
Compress Option is a class used to select which option to use.
class CompressOption {
Quality quality;
Resolution resolution;
OutputType outputType;
}
copied to clipboard
Resolution aims to set the resolution whether it is the same as the input image or not, meaning if it is res75 then the resolution drops by 25% from the previous original resolution, the ratio remains unchanged (default: res100)
enum Resolution {
res100,res75,res65,res55,res50
} //(default : res100)
copied to clipboard
Quality aims to set the compression capability, the higher the compression results will be more optimal (default: medium)
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.