fc_native_image_resize 0.7.0 copy "fc_native_image_resize: ^0.7.0" to clipboard
fc_native_image_resize: ^0.7.0 copied to clipboard

A Flutter plugin to resize images via native APIs.

fc_native_image_resize #

pub package

A Flutter plugin to resize images via native APIs.

iOS Android macOS Windows
Path
Uri - - -

Supported image formats:

  • Read
    • JPEG, PNG
    • Platform native image formats. e.g. HEIF/AVIF on iOS/macOS
  • Write
    • JPEG, PNG

NOTE on Windows: It's recommended to use the image package instead of native Windows APIs as the latter has limited support for image formats.

Usage #

final plugin = FcNativeImageResize();

try {
  ///
  /// Resizes the [srcFile] with the given options and saves the results to [destFile].
  ///
  /// [srcFile] source image path.
  /// [srcFileUri] true if source image is a Uri (Android only).
  /// [destFile] destination image path.
  /// [keepAspectRatio] if true, keeps aspect ratio.
  /// [format] destination file format. 'png' or 'jpeg'.
  /// [quality] only applies to 'jpeg' type, 1-100 (100 best quality).
  await plugin.resizeFile(
            srcFile: srcFile,
            destFile: destFile,
            width: 300,
            height: 300,
            keepAspectRatio: true,
            format: 'jpeg',
            quality: 90);
} catch (err) {
  // Handle platform errors.
}