I need to upload a large image with dimensions of 2450 x 2450 pixels.
Bitmap bitmap = ImageLoader.getInstance().loadImageSync(url, ImageConfig.getImageOptions());
The problem is that an exception was received from the memory on a low-level device (a phone with RAM less than 1 GB).
This is my DisplayImageOptions
public static DisplayImageOptions getImageOptions() { DisplayImageOptions.Builder options = new DisplayImageOptions.Builder(); options.delayBeforeLoading(10) //The reason I'm using ARGB_8888 because I need to load bitmap without losing it quality .bitmapConfig(Bitmap.Config.ARGB_8888) .imageScaleType(ImageScaleType.NONE) //I'm not using disk or memory cache .cacheOnDisk(false) .cacheInMemory(false); return options.build(); }
I tried to add the target size based on the resolution of the device, but it does not work, the downloaded bitmap still has dimensions of 2450 x 2450 pixels.
int height = orientation == Configuration.ORIENTATION_PORTRAIT ? displaymetrics.heightPixels : displaymetrics.widthPixels; Bitmap bitmap = ImageLoader.getInstance().loadImageSync(imageUri, new ImageSize(height, height), ImageConfig.getImageOptions());
I tried to change imageScaleType to ImageScaleType.EXACTLY by downloading a bitmap with a size of up to 1225 x 1225 pixels on all devices, I need to get the original dimensions for a high-performance device and resize for a low-level device.
The main problem is the size of the target does not work.
Any idea how to upload an image, especially for a low-maintenance device?
source share