You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in pubspec.yml use image: ^4.2.0
import 'package:image/image.dart' as img; // Import package image
onCropped: (croppedData) {
setState(() {
_croppedData = croppedData;
});
final decodedImage = img.decodeImage(_croppedData!);
if (decodedImage != null) {
int width = decodedImage.width;
int height = decodedImage.height;
print("Cropped image size: Width = $width, Height = $height");
}
},
or resize image
Uint8List _resizeImage(Uint8List imageData, int targetWidth, int targetHeight) {
final decodedImage = img.decodeImage(imageData);
if (decodedImage != null) {
// Resize gambar ke ukuran 300x400
final resizedImage = img.copyResize(decodedImage, width: targetWidth, height: targetHeight);
return Uint8List.fromList(img.encodeJpg(resizedImage)); // Bisa juga gunakan encodePng
}
return imageData;
}
No description provided.
The text was updated successfully, but these errors were encountered: