|
|
@ -3,7 +3,6 @@ import 'dart:developer'; |
|
|
|
import 'package:flutter/foundation.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:image/image.dart' as image_lib; |
|
|
|
import 'package:image_picker/image_picker.dart'; |
|
|
|
import 'package:palette_generator/palette_generator.dart'; |
|
|
|
import 'package:tuple/tuple.dart'; |
|
|
|
|
|
|
@ -43,25 +42,6 @@ class ImageSplitter { |
|
|
|
return paletteGenerator; |
|
|
|
} |
|
|
|
|
|
|
|
Future<Tuple3<Image, Uint8List, PaletteGenerator>?> getImage({required ImagePicker picker}) async { |
|
|
|
final pickedFile = await picker.pickImage(source: ImageSource.gallery); |
|
|
|
|
|
|
|
if (pickedFile != null) { |
|
|
|
// final imageFile = File(pickedFile.path); |
|
|
|
// final image = Image.file(File(pickedFile.path)); |
|
|
|
final image = Image.memory(await pickedFile.readAsBytes()); |
|
|
|
final palette = await getImagePalette(image.image); |
|
|
|
// final PaletteGenerator palette = await getImagePalette( |
|
|
|
// FileImage(imageFile), |
|
|
|
// ); |
|
|
|
final bytes = await pickedFile.readAsBytes(); |
|
|
|
log('Image properties retrieved'); |
|
|
|
return Tuple3(image, bytes, palette); |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
Future<List<Image>> runSplitterIsolate(List<int> input, int size) async { |
|
|
|
final Map<String, dynamic> data = { |
|
|
|
'input': input, |
|
|
|