dartpub.dev DartNative · beta
plugins / dartnative_image_crop
di

dartnative_image_crop

v1.0.0 dartpub Free

Native image cropping

The native image cropper for DartNative — an interactive `Crop` widget plus programmatic `cropImage`, with the heavy lifting in native code so large photos stay fast and memory-friendly. Inspect and downsample too.

by DartNative/dartnative_image_crop · DartNative ≥ 3.0 · updated 3 weeks ago
Install
Free
pubspec.yaml
dependencies:
  dartnative_image_crop: ^1.0.0
Weekly installs
2
Active apps
3
Rating
0.0 · 0
Open issues
0

dartnative_image_crop

Crop, sample, and inspect images natively in DartNative — an interactive Crop widget plus programmatic cropping that stays fast and memory-friendly on large photos. iOS and Android.

Why you'll like it

  • Two ways to crop — drop the interactive Crop widget, or crop programmatically with cropImage(...).
  • Native + memory-friendly — the heavy lifting happens in native code, so big images don't blow up your heap.
  • Inspect & downsample — read an image's dimensions, or sample it down to a target size.

Highlights

  • Crop — an interactive crop widget (pan / zoom to frame the crop).
  • DartNativeImageCrop.cropImage({file, area, scale}) — crop to a normalized Rect.
  • getImageOptions({file}) — read the image's dimensions; sampleImage(...) — downsample.

Install

dependencies:
  dartnative_image_crop: ^1.0.0   # from dartpub.dev
dn pub get
void main() {
  DartNativePluginRegistrant.registerAll();
  runApp(const MyApp());
}

Quick look

import 'package:dartnative_image_crop/dartnative_image_crop.dart';

Crop programmatically — area is a normalized Rect (0–1):

final cropped = await DartNativeImageCrop.cropImage(
  file: file,
  area: const Rect.fromLTWH(0.1, 0.1, 0.8, 0.8), // centered 80%
);

Read dimensions first:

final opts = await DartNativeImageCrop.getImageOptions(file: file);

Or let the user frame it with the interactive widget:

Crop(/* … */); // pan & zoom to choose the crop

Platform setup

iOS

No native setup required.

Android

No native setup required.

Example

The example/ app crops a picked image both ways — borrow from it freely.

Credits & license

Ported from image_crop (lykhonis, Apache-2.0), reworked to FFI.

Commercial plugin distributed via dartpub.dev — file issues on the plugin's page.