fast_image_resizer 0.0.2 copy "fast_image_resizer: ^0.0.2" to clipboard
fast_image_resizer: ^0.0.2 copied to clipboard

Resize images with native implementations. Supports only PNG as output.

fast_image_resizer #

This package uses native implementations to resize an image. It should be fast compared to the image package. It only supports PNG as output at the moment.

This package has zero dependencies.

Features #

  • Supported inputs: JPEG, PNG, GIF, Animated GIF, WebP, Animated WebP, BMP, and WBMP
  • Supported outputs: PNG

Getting started #

Add fast_image_resizer to your pubspec.yaml

Usage #

import 'package:fast_image_resizer/fast_image_resizer.dart';
import 'dart:typed_data';
copied to clipboard
final rawImage = await rootBundle.load('assets/someImage.png');
final bytes = await resizeImage(Uint8List.view(rawImage.buffer), width: 150);
if (bytes != null) {
    final imageWidget = Image.memory(Uint8List.view(bytes.buffer));
    showDialog(
        context: context,
        builder: (BuildContext context) {
            return AlertDialog(
            title: const Text("Image"),
            content: imageWidget,
            );
        }
    );
}
copied to clipboard

or

final ImagePicker _picker = ImagePicker();
final XFile? image =
    await _picker.pickImage(source: ImageSource.gallery);
if (image != null) {
    final rawImage = await image.readAsBytes();
    final bytes = await resizeImage(Uint8List.view(rawImage.buffer), height: 250);
    if (bytes != null) {
        final testing = Image.memory(Uint8List.view(bytes.buffer));
        showDialog(
            context: context,
            builder: (BuildContext context) {
                return AlertDialog(
                    title: Text("Image"),
                    content: testing,
                );
            }
        );
    }
}
copied to clipboard
19
likes
160
points
750
downloads

Publisher

unverified uploader

Weekly Downloads

2024.10.03 - 2025.04.17

Resize images with native implementations. Supports only PNG as output.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on fast_image_resizer