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.

example/fast_image_resizer_example.dart

import 'package:fast_image_resizer/fast_image_resizer.dart';
import 'package:flutter/material.dart';
import 'dart:typed_data';
import 'package:flutter/services.dart' show rootBundle;

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: "Image resizer",
        home: TextButton.icon(
            label: Text("Choose picture"),
            icon: Icon(Icons.camera),
            onPressed: () async {
              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,
                      );
                    });
              }
            }));
  }
}
19
likes
160
points
871
downloads

Publisher

unverified uploader

Weekly Downloads

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