xCreateThumbnails_fromImage method
Metodo per la creazione di una miniatura da un Video Metodo per la creazione di una miniatura da una Foto
Implementation
// Future<Uint8List?> xCreateThumbnail_FromVideo(String blobURL) async {
// var x = await thumb.VideoThumbnail.thumbnailData(
// video: blobURL,
// imageFormat: thumb.ImageFormat.PNG,
// maxWidth: 128, // specify the width of the thumbnail, let the height auto-scaled to keep the source aspect ratio
// quality: 25,
// );
// return x;
// }
///Metodo per la creazione di una miniatura da una Foto
Uint8List xCreateThumbnails_fromImage(Uint8List image_payload, {int? width}) {
final imgOri = img.decodeJpg(image_payload)!;
if (width == null) width = 100;
var height = width * imgOri.height ~/ imgOri.width;
if (height > 100) {
height = 100;
width = height * imgOri.width ~/ imgOri.height;
}
var resizedImg = img.copyResize(imgOri, width: width, height: height);
final pngBytes = img.encodePng(resizedImg);
return pngBytes;
}