Flutter - Resize network image

江枫思渺然 提交于 2021-02-10 23:32:04

问题


Is there a way to resize an image without having it previously written to storage? I am using a pdf library that for the images needs the bytes of it.

What I do is get image with an http.get and I get the bytes to put it in the pdf. The problem is that I need to resize the image BEFORE putting it in the pdf.

The only thing I have is the url of the image or the uint8list

Response response = await http.get(imageUrl);
Uint8List imgBytes = response.bodyBytes;

Later:

Image(
    PdfImage.file(pdf.document,
    bytes: imageBytes)
),

Pdf lib I use: https://pub.dev/packages/pdf

来源:https://stackoverflow.com/questions/63063906/flutter-resize-network-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!