Hello All,
Is there a way to compress an image that is already in a bitmap but WITHOUT first saving it to a compressed image first then loading in again.
Basically I'm looking for a solution that will compress a bitmap without saving it first, the bitmaps are loaded directly from an online MySQL database but needed compressing before putting into a list of ImageViews.
Yes I can use LoadBitmapSample or even LoadBitmapResize but that means first saving the image to a file as a compressed jpg then load it into ImageViews. Doing it that way (saving compressed file) does work but scrolling using xCustomListView with lazy loading causes the list to stagger, especially on slower devices.
Just for TESTING PURPOSED ONLY I tried using LoadBitmap which does load the full sized images directly into the ImageViews lists (not recommended), xCustomListView with lazy loading and it strangely ran smoother but still not perfect, but obviously sooner or later there WILL BE an out of memory issue especially on lesser devices.
So the obvious solution to me is compressing the bitmap on the fly (not saving it first) then placing it directly into the xCustomListView ImageViews.
Saving a compressed jpg and reloading it is not really an option, I'm trying to do it on the fly.
Thank you...
Tested on Galaxy S4, HTC Desire, N5, N6P and Pixel XL, it does the same on all of them. If bitmap.compress existed that might have helped with this issue.
P.S. I also tried implementing Inline Java but I couldn't get it working correctly, so I deleted the code.
Cheers...
Is there a way to compress an image that is already in a bitmap but WITHOUT first saving it to a compressed image first then loading in again.
Basically I'm looking for a solution that will compress a bitmap without saving it first, the bitmaps are loaded directly from an online MySQL database but needed compressing before putting into a list of ImageViews.
Yes I can use LoadBitmapSample or even LoadBitmapResize but that means first saving the image to a file as a compressed jpg then load it into ImageViews. Doing it that way (saving compressed file) does work but scrolling using xCustomListView with lazy loading causes the list to stagger, especially on slower devices.
Just for TESTING PURPOSED ONLY I tried using LoadBitmap which does load the full sized images directly into the ImageViews lists (not recommended), xCustomListView with lazy loading and it strangely ran smoother but still not perfect, but obviously sooner or later there WILL BE an out of memory issue especially on lesser devices.
So the obvious solution to me is compressing the bitmap on the fly (not saving it first) then placing it directly into the xCustomListView ImageViews.
Saving a compressed jpg and reloading it is not really an option, I'm trying to do it on the fly.
Thank you...
Tested on Galaxy S4, HTC Desire, N5, N6P and Pixel XL, it does the same on all of them. If bitmap.compress existed that might have helped with this issue.
P.S. I also tried implementing Inline Java but I couldn't get it working correctly, so I deleted the code.
Cheers...
Last edited: