Android image size reduction - android

I got an app which is loaded with many image files which takes much place. The app can also download more pictures from different sources. Is there a way to compress their size?
I remember there was maybe some sort of library created by Google specifically for this issue?

Related

Including thousands of images in Xamarin Forms application

I have a xamarin forms project for the company I work for. I have 6000+ images used in two ways : a thumbnail page and a full size page. I have both the thumbnail image and the full size image. The thumbnail page shows 12 products at a time, but it lives in a carousel page so it could have up to 18 content pages within the carousel.
I've tried three ways of saving/accessing the images:
Including them as bundle/android resources. This works the best but takes forever to build the project and on android will mean I have to use expansion files.
Included the binary image from the database when downloading the product listing. Causes the app to crash randomly on download.
Downloading all of the files from the web. This works, but on both Android and iOS, the thumbnail screen slows to a crawl and half of the time crashes on Android.
Has anyone had to do something similar and if so, what way did you decide to go? Unfortunately, this app does have to be usable offline so I need the images local. I'm kind of in a time crunch so any help would be appreciated!!
I had similar issues someday back and understood that it won't be successful with standard Image class with such a large amount of images (no memory caching, no task queueing, etc). Then I made CachedImage. It's basically an API compatible replacement for Image with advanced caching capabilities (and some other features). You could try that.
Just remember to use:
Downsampling feature : that way image would be resized to view size to save memory
Caching feature (it's enabled by default not including StreamImageSource for which you have to provide custom cache key factory)
Use FileImageSource (app dir) or StreamImageSource (eg. from image database) with custom cache keys
https://github.com/molinch/FFImageLoading (See WIKI for docs)

Handling lots of drawables in android project

I am beginner in Android development. I need to show 400+ images in my android app. Right now I am putting all of them in my drawable folder, but this doesn't seem good, as my apk becomes too large in size. What should I do? Can I play with images' resolution and all? Please help.
best solution will be to put them in web and then displaying it through lazy list, But if thats not an option then only thing you can do is to compress your image to a extent it is acceptable, that will check you problem of large apk size.
try PNGOUT , a great tool for compressing images.
Put them all in a extension-obb-File:
http://developer.android.com/google/play/expansion-files.html
So I handled it with videos.

My .apk is 273MB because of my images for animation, isn't that too much?

I never saw an app that is 273MB, I have to be doing something wrong; I have 75 pngs for an animation. An app is not supposed to be that big, right?
Your app can definitely be that size. Many games are huge in size. You'll have to use the APK expansion files method provided by google for this. See here:
https://developer.android.com/guide/google/play/expansion-files.html
You'll have to store them on the SD card as they'll be too big for internal memory.
Also consider compression or smaller file sizes as alternatives although this depends highly on what you plan to do with your images (if it's very important that the images be high-res, then don't compress).
From the Google Play website the maximum allowed size for the APK on Google Play is 50 MB but you can use expansion files mechanism if you need more data (2GB per file)
I'd suggest you though to find a way to use fewer PNG images or optimize it somehow...
You can put your images on a server and first time entering your app download them on the sdcard. You'll know better if this fits your application :)

How to handle large images in android

i'm writing a simple application. i need to handle around 100 images having size dimension 1000*740. images are fixed no need to change. user will see this images like gallery view.
Problem
1.Large number of Images increases .apk filesize .It crosses memory limit(Given by Android market).
2.I placed these images in Drawable folder.Is there any other way to keep this images?
Any Idea?
YOu can host them on a separate site, but you do not have to download them every time. You can download them to an external directory (sd card) and just check if you've got everything you want when starting the app: If you do, you obviously don't have to re-download the shots again.
Is there a reason your images are of that size? If you compress them a bit you should be able to fit a photo in less then half an MB, and I think that the limit is 50mb on the market: You might be able to just squeeze it in.
Upload all the images to a link. Do parsing by using that link.
That's a pretty tough dilemma. Perhaps the user can download the images instead. You could use flickr to host the images.
I would suggest hosting them somewhere and download as "citizen conn" suggested.
Another possibility would be to separate in different sets and have different apk with those (maybe some of them would only have a content provider with some of those pictures). But that's kind of ugly...
Other than that, I don't think there is any way to get around the limit from Android market...

Smaller APK size with large assets?

I am creating a simple android app to view a comic book. The pages are large(0.5-1 mb each), high quality .png's and I am loading them into a webview to make use of the built in zoom controls. So far I only have 17 files and the APK size is already about 16 mb. I'm looking to add over 200 files in future updates. I can't really reduce the quality too much because there is small text that must be zoomed-in on to read. Any suggestions? A similar question was posted here: How to reduce App (.apk) Size, but I don't want to lose the quality of the images. I'm not sure if it's appropriate to link to here, but you can have a look at my app by searching for Tracer (by Detour Mobile) on the android market if it helps at all. Thanks in advance.
You could compress them without using lossy compression- e.g. zipping/rarring them, but I don't believe this would gain you much more than a few kilobytes here and there. Otherwise, try using a more compact format than PNG, such as JPEG (you won't lose too much quality.) By the way, all of this was suggested in the referenced post.
If you do decide to scale down the images' size somewhat, be sure to use a method like bicubic sharper- it tends to look better than others when reducing image size.
Another option would be to download the images for the comic that is being read on-the-fly with pre-fetching so reading would not be interrupted as much.
Consider placing your images in Assets folder as opposed to Res. The big difference is, Assets content won't be compiled into R.java class so you will see major storage savings. You'd have to modify your code though as you won't be able to call up the images via the regular r.resID notation, but it's doable
android offers a new way to deal with it.
android app bundle apk size has a maximum size of 150mb
but you can use an asset pack to seperate the apk from the static files
and upload your app
here is a more detailed explanation about asset packs:
https://developer.android.com/guide/playcore/asset-delivery
here is the guide for integrating asset packs with regular android app:
https://developer.android.com/guide/playcore/asset-delivery/integrate-java

Categories

Resources