v0.0.2
fast_image_resizer
使用原生實作調整影像大小。僅支援 PNG 為輸出格式。
19喜歡 2840近 30 天下載160Pub 分數
AndroidiOSWebmacOSWindowsLinux
zsoerenm/fast_image_resizer open-source repository details.
以下為英文專案原文快照,最新內容請造訪 GitHub。
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.
Add fast_image_resizer to your pubspec.yaml
import 'package:fast_image_resizer/fast_image_resizer.dart';
import 'dart:typed_data';
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,
);
}
);
}
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,
);
}
);
}
}
依賴清單 3 項
{"sdk":"flutter"}{"sdk":"flutter"}^1.0.0先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗