Android sdk edit big images - android

i have made an image editing application for android and i want to edit large images that there is not available memory size to load all of their data into it. Is there any library that provide api that load and stores part of an image so i can have an edit only a portion that fits the memory? Photoshop for android can edit images up to 1600x1600, how this is possible?

You can use matrices to scale the image, take a look at this code Is hard to understand, but it might bring you some light.

You can use BitmapRegionDecoder to elaborate blocks of the large image.

Related

where to store images?

I am creating an app that uses more than two hundred images. To display images, lmageView is used. My question is- Is it necessary to put images in drawable-hdpi,drawable-mdpi,drawable-xhdpi,drawable-xxhdpi. If I put the images in these four folders, does my app size increases?
Please help me. Thanks in advance.
Well I guess if your image set will not change in the future maybe that's the best place to store them. Your app size will certainly increase, however, if that's a concern you can store them using any cloud service like parse.com or firebase, so you can retrieve them later using a library like picasso
You don't have to put pictures in all folders. There are folders for different image resolutions. You can use a single folder called drawable or just use drawable-mdpi. The app size increase with multiple image versions. There are some disadvantages when you use only one folder.
If you have big resolution images inside your folder: For a presentation, small screen devices have to minimize the image. This costs hardware ressources. If it costs to much ressources, your app will crash.
If you have small resolution images inside your folder: For a presentation, big screen devices have to upscale the image. This will result in bad image quality.

In android and any mobile app, why is it launched in small sizes?

For example, when I created an app in android.
I included a image file in the app. When I added the image, the app's
file size increased exactly as image size.
But my question is, many apps in google play apps includes so much images but
why do they have so small amount of file size?
Is it that they don't use picture format and using drawing api like canvas?
Because there these images are not being stored in app memory, In runtime they are downloading the images and displaying in the application. So There application size is not that much big.
But in your application you are storing images in drawable folder that is why your app size is getting increased upto as much image size is.
Most of them create a hidden file in storage... And then load their images from their... Some developers also load image only in run-time. Suppose you have a webview behind a Layout. That WebView is only for loading a image. If you set OnClickListener on this Layout then it behaves like a image button. its a silly example :P
The best practice is to use Glide or Picasso to load image from server to your imageview.
https://github.com/bumptech/glide
http://square.github.io/picasso

Using SVG files in android and memory usage

My application has an activity with metro schema, so for good quality I need to put image with resolution more then 2000x2000, but such images use much memory and application crashes with Out of memory error.
Does this problem will solve when I will change the image source to SVG (by svg-android for example)?
It depends on the complexity of image simple vector re presentable image will defiantly improve the performance otherwise complex images will use more memory.
more Details here.

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.

Android efficient storage of two images which are similar

Application size on a phone needs to be as small as possible. If I have an image of a sword and then a very similar image of that same sword except that I've changed the color or added flames or changed the picture of the jewel or whatever, how do store things as efficiently as possible?
One possibility is to store the differences graphically. I'd store just the image differences and then combine the two images at runtime. I've already asked a question on the graphic design stackexchange site about how to do that.
Another possibility would be that there is that apk already does this or that there is already a file format or method people use to store similar images in android.
Any suggestions? Are there tools that I could use to take two pngs and generate a difference file or a file format for storing similar images or something?
I'd solve this problem at a higher level. For example, do the color change at run-time (maybe store the image with a very specific color like some ugly shade of green that you know is the color to be fixed at run-time with white or red or blue or whatever actual color you want). Then you could generate several image buffers at load-time.
For compositing the two images, just store the 'jewel' image separately, and draw it over the basic sword. Again, you could create a new image at load-time, or just do the overdraw at run-time.
This will help reduce your application's footprint on flash, but will not reduce the memory footprint when the app is active.
I believe your idea of storing the delta between 2 images to be quite good.
You would then compress the resulting delta file with a simple entropy coder, such as Huffman, and you are pretty likely to achieve a strong compression ratio if similarities with base image are important.
If the similarity are really very strong, you could even try a Range Coder, to achieve less-than-one-bit-per-pixel performance. The difference however might be noticeable only for larger images (i.e higher definition than a 12x12 sprite).
These ideas however will require you or someone to write for you such function's code. This should be quite straightforward.
An very easy approach to do this is to use an ImagePack ( one image containing many ) - so you can easy leverage the PNG or JPG compression algorithms for your purpose. You then split the images before drawing.

Categories

Resources