Is it possible to compress without saving in files images from API to resize image?
I found one of packages which is doing this job - flutter_native_image: ^0.0.6
but all of these packages works onle if I am going to pick uup images from file storage and after that to reduce size to dowload it to my app.
So can I reduce image weight? Now it is 2MB images which comes from API.
I was trying this thing:
if (hubConnection.state == HubConnectionState.Connected) {
await hubConnection.invoke('GetImage', args: [carId]).then((value) {
carImage = value as String;
});
var compressed = await FlutterNativeImage.compressImage(carImage ?? '',
quality: 50, percentage: 30);
print(compressed);
print('is it compressed?');
}
But it gives me an error: '[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(file does not exist, iVBORw0KGgoAAAANSUhEUgAAB4AAAAQ4CAIAAABnsVYUAAAgAElEQVR4AXzBi65tWZqd1e/rY659TkRmpatsGXFHyI+BQOJJAPHkIHGxJVOUMzMizl5z/J2xduQ+kVUUtOaP/+N/90V3+x+4mA0XRxdHw1F'
I understood it says about my carImage
variable is not File type, but Base64 type, so if there is any chance to make image size smaller without reaching out backend devs?