flutter_color_extractor 1.0.0+1 copy "flutter_color_extractor: ^1.0.0+1" to clipboard
flutter_color_extractor: ^1.0.0+1 copied to clipboard

A Flutter package to extract colors from images.

Flutter Color Extractor #

style: very good analysis Powered by Mason License: MIT

A simple Flutter package for extracting the most dominant colors from images, with results sorted from highest to lowest percentage contribution.

Installation #

❗ In order to start using Flutter Color Extractor you must have the Flutter SDK installed on your machine.

Install via flutter pub add:

dart pub add flutter_color_extractor

Features #

  • Extract dominant colors from asset (local) images
  • Extract dominant colors from network (remote) images
  • Returns a List<Color> ordered by descending percentage (highest coverage first)
  • Easy-to-use API compatible with any Flutter project

Usage #

Import the package:

import 'package:flutter_color_extractor/flutter_color_extractor.dart';

Extract from asset images #

final extractor = const ColorExtractor();
final bytes = await rootBundle.load('assets/sample1.jpeg');
final data = bytes.buffer.asUint8List();
final colors = await extractor.extractColorsFromBytes(data);

Extract from network images #

final extractor = const ColorExtractor();
final colors = await extractor.extractColorsFromNetwork('https://example.com/image.jpg');

Demo #

Color Extractor Demo

API Reference #

ColorExtractor #

Method Description
Future<List<Color>> extractColorsFromBytes(Uint8List bytes) Extracts dominant colors from raw image bytes, sorted by coverage.
Future<List<Color>> extractColorsFromNetwork(String url) Fetches an image from a URL and extracts dominant colors.
Future<List<Color>> extractColorsFromextractColorsFromPath(String imagePath) Converts the path to a file and extract dominant colors from the image.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

1
likes
150
points
1
downloads

Documentation

Documentation
API reference

Publisher

verified publishermubharaq.dev

Weekly Downloads

A Flutter package to extract colors from images.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, http, image

More

Packages that depend on flutter_color_extractor