From e42bd5045cf7ff78adac79eb831154e852e49d10 Mon Sep 17 00:00:00 2001 From: mde-pach <12986913+mde-pach@users.noreply.github.com> Date: Thu, 12 Mar 2020 17:49:10 +0100 Subject: [PATCH] add option to set the max bitmap generated size. Default to 0 --- README.md | 1 + .../flutter/plugins/imagecropper/ImageCropperDelegate.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index b463d6d4..dfe76e51 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ The result file is saved in `NSTemporaryDirectory` on iOS and application Cache | `lockAspectRatio` | set to true if you want to lock the aspect ratio of crop bounds with a fixed value (locked by default) | bool | | `hideBottomControls` | set to true to hide the bottom controls (shown by default) | bool | | `initAspectRatio` | desired aspect ratio is applied (from the list of given aspect ratio presets) when starting the cropper | CropAspectRatioPreset | +| `maxBitmapSize` | the maximum size of the Bitmap object generated after cropping | int | ### iOS diff --git a/android/src/main/java/vn/hunghd/flutter/plugins/imagecropper/ImageCropperDelegate.java b/android/src/main/java/vn/hunghd/flutter/plugins/imagecropper/ImageCropperDelegate.java index fc3d2d6f..39f6a67d 100644 --- a/android/src/main/java/vn/hunghd/flutter/plugins/imagecropper/ImageCropperDelegate.java +++ b/android/src/main/java/vn/hunghd/flutter/plugins/imagecropper/ImageCropperDelegate.java @@ -41,6 +41,7 @@ public void startCrop(MethodCall call, MethodChannel.Result result) { Integer compressQuality = call.argument("compress_quality"); ArrayList aspectRatioPresets = call.argument("aspect_ratio_presets"); String initAspectRatio = call.argument("android.init_aspect_ratio"); + Integer maxBitmapSize = call.argument("android.max_bitmap_size"); pendingResult = result; @@ -52,6 +53,7 @@ public void startCrop(MethodCall call, MethodChannel.Result result) { UCrop.Options options = new UCrop.Options(); options.setCompressionFormat("png".equals(compressFormat) ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG); options.setCompressionQuality(compressQuality != null ? compressQuality : 90); + options.setMaxBitmapSize(maxBitmapSize != null ? maxBitmapSize : 0); // UI customization settings if ("circle".equals(cropStyle)) {