selectcropcompressimage 0.0.22 copy "selectcropcompressimage: ^0.0.22" to clipboard
selectcropcompressimage: ^0.0.22 copied to clipboard

outdated

A new Flutter package to select, crop and compress image.

SelectCropCompressImage #

A package to select, crop and compress images all through one call. #

A package to select, crop and compress images all through one call.A package to select, crop and compress images all through one call. Image selection is done via Image Picker package, Image Cropping is achieved through the Image Copper package and finally the compression is done using the Flutter Image Compress package.

Features #

  • Image Selection
  • Image Cropping
  • Image Compression

Getting started #

  • Import this package!
  • (FOR ANDROID ONLY) Add the following lines of code in your android manifest file.
    <activity
        android:name="com.yalantis.ucrop.UCropActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
  • (FOR iOS, no further configurations needed!)
  • Create instance of the SelectCropCompressImage class and call the selectCropCompressImage function with the required parameters passed! And thats it!! :D

Required parameters #

  • compressionAmount: the amount of compression the image will go through before returning.

Optional parameters #

  • aspectRatioX: the X axis AspectRatio for image cropping. Default is 1.
  • aspectRatioY: the Y axis AspectRatio for image cropping. Default is 1.

Additional information #

**The CompressionAmount needs to be in a range of 0-100. Otherwise the default compression amount will be used, which is 0.

Example #


import 'package:selectcropcompressimage/selectcropcompressimage.dart';

Future getImageFromGallery() async {
  SelectCropCompressImage selectCropCompressImage = SelectCropCompressImage();
  Uint8List? selectedCroppedAndCompressImage =
      await selectCropCompressImage.selectCropCompressImageFromCamera(
    compressionAmount: 30,
  );
  if (selectedCroppedAndCompressImage != null) {
    //Do something with the image
  } else {
    //Discard...
  }
}

Future getImageFromCamera() async {
  SelectCropCompressImage selectCropCompressImage = SelectCropCompressImage();
  Uint8List? selectedCroppedAndCompressImage =
      await selectCropCompressImage.selectCropCompressImageFromCamera(
    compressionAmount: 30,
  );
  if (selectedCroppedAndCompressImage != null) {
    //Do something with the image
  } else {
    //Discard...
  }
}


** View in file at implemented_example/example.dart

Note #

  • The result file is saved in NSTemporaryDirectory on iOS and application Cache directory on Android, so it can be lost later, you are responsible for storing it somewhere permanent (if needed).
7
likes
0
pub points
62%
popularity

Publisher

unverified uploader

A new Flutter package to select, crop and compress image.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_image_compress, image_cropper, image_picker

More

Packages that depend on selectcropcompressimage