I am developing a live wallpaper and I would like to know how to manage high quality images. I am quite new to android development by the way.
I got 2 questions:
1)The image I use for wallpaper creation is a vector image (2560w x 1600h, 32bit, 10mb exactly), very crispy and with really high resolution. I tried it as a wallpaper and it looks just fantastic (on my tablet). I placed it in the drawable folder. This results in a high dimension .apk file (9 Mb). Is it ok to have files this big enlarge apk dimension or it is a good practice to reduce it as much as possible?
2)When building my wallpaper from the Engine class i'd like to know, after setting the above image as a wallpaper, what is the best practice to scale it fitting XY independant of screen sizes.
PS: What i found to be perfect was the default system android use when you attempt to set an image as wallpaper. What does the system do in that case?
Thanks :)
1.)Since no android device supports resoultion bigger than 1280x760 of what I know, it is not a good practice in having images with bigger size than this as they use a lot of space for nothing.
2.)The DisplayMetrics class has everything you need related to this problem.
Related
Regarding Android's call to provide multiple versions of a bitmap/image, why can't only the highest resolution image be used?
E.g if the xxhdpi image is available - will that be able to scale down to all lower density versions or will it just mean it will scale bigger than the allocated size (View)?
PS: If I'm using a background image, does scaling matter? E.g. should I still provide multiple versions of 1 image to fit different pixel densities?
Usually image scaling operation is resourceful and the outcome might be worse than using pre-scaled image.
It has already been answered several times, but I will answer it again. Btw I'm not myself a big pro in Android, but I will try to answer in the best way possible.
Automatic scaling is a thing in Android, but using that is a waste of resource, we already know that using a PNG Graphic asset is a waste of CPU/GPU power when we can use XML for basic designs (which uses less resources), so why waste more power for downscaling it (which increases app opening time and makes it laggy), simply creating multiple sized images for different display sizes is the best option.
A simple and convenient option is to use a free software like Adobe XD which supports export into different sizes.
Simple answer: Avoid using PNG(or other image format), but when you don't have other options do create multiple sizes to save resources.
I've read a lot of different posts and articles about how screen sizes are determined and it's pretty confusing to say the least so I thought I'd just ask!
Here are the facts:
I have developed an app that has a big logo on the login screen. This logo is 958x496 and is 30.6KB. It's a real nice big sharp looking image!
I have four development phones that each use different drawable sizes ranging from hdpi to xxxhdpi.
I currently have a dawable-nodpi folder that has the logo in and every phone uses it but I feel like this isn't the 'proper' way to do it so I'm trying to have different sized images for each phone.
So, I want to use this full 958x496 image as the baseline for the xxxhdpi drawable and I will scale them down accordingly using the 3:4:6:8:12:16 scaling ratio (meaning the full image will be my '16').
As it currently stands if I do that, for the hdpi phone I get an image that is 354x183 as its roughly 37% of full size. I run up the app and yes the logo looks great but here is the question.. if I use drawable-nodpi instead it will use the full 958x496 image and it looks better so why should I downsize my image when it will look slightly blurry? Why not just use the best possible version of the image? I thought this was because I wouldn't get the benefits of the high quality image on the lesser phone, but you can definitely tell a difference.
I have been programming an application for Android. I want to target it for more devices(tablets, smartphones). I tried to find some info at http://developer.android.com/guide/practices/screens_support.html but it does not work correctly.
I want to automatically stretch images on different devices, not only in my testing device. I draw images for the mobile full screen (which has the same resolution as my mobile). But, for example in the tablet it draws incorrectly. I tried to change the size and it gives several folders(lhdpi, small, ...). When I tried to start it again in the tablet, it was bigger but still incorrect (there was a black space on the edges). I have several images in my application, and I want to retain the same size as in the mobile too. Please, help me.
Sorry for my spelling mistakes.
you have to maintain aspect ratio at your own . don't put same sized images in all folder (hdli, mdpi, ldpi), if this was the case they think why android provides different foldes ? put images in ratio 0.75 : 1 : 1.5 . it will work .
additionally read about 9-patch images, this will make your life much easier .
I'm quite new to Android development. My understanding is that you can create several versions of the same image with different sizes and put them into the folders drawable-ldpi, drawable-mdpi, drawable-hdpi.
It seems obvious to me that you can handle this problem "the lazy way" by just resizing one image depending on the device's pixel density. For this I programmatically find out what density the device has, like ldpi. The implementation itself is not the problem. I'm just afraid of any drawbacks (that prevent me later from running the app on different devices).
So, are there any (major) drawbacks of scaling images automatically ?
In which of the three folders do I put the image so that the compiler can find it?
You would put the image in your regular drawable folder. That way any phone can find it.
While you can programatically shrink images, shrinking usually has the effect of reducing image detail and causing jaggies.
Adding in smaller assets will also reduce memory usage on smaller phones. Keep in mind that some Android phones are notoriously bad with memory (see: HTC Status), so any and all savings help.
I would recommend just photoshop scaling images down large images yourself. For smaller images, it is not as big a deal.
Android does auto-scale and it works fine in some cases, but it doesn't work for many, notably small images with important details like text. Scaling a larger image down blurs those details. Scaling a smaller image up is worse. This is why icons files have been multi-resolution since the very early days of GUIs. To wit, text scaling is hugely complicated. Ask any font designer, and note Adobe built a company on algorithms to do it automatically.
it's on mdpi folder. It'll change the size automatically. But is not recommended since the image quality drops.
I am working on android app. I see lot of apps say they have hd graphics and i can see some difference in their graphics and mine. I searched on google also but cannot get exact answer as to what actually hd graphics means? Is it some kind of format like .png or is it resolution like 400*800. I mean if i want to make hd image of a simple button how can i do that? Can anyone please explain in deatail keeping android apps in mind. Thanks in advance!
Basically you need to check out the definition of HD. That stands for High Definition and it's main idea is that by making resolution big, on bigger screens the quality of an image or a video won't look bad.
About Buttons, in Android or any other OS most of the times vector graphics are used instead of bitmaps. Vector graphics are just some coordinates which make up graphic, so when you zoom in or display a vector graphic on a big screen it won't lose it's quality. Bitmaps are collections of pixels. Check this out to get a basic understanding of dpi and pixels: http://en.wikipedia.org/wiki/Dots_per_inch
In order to use bitmaps efficiently for buttons and that kind of controls I'd suggest taking a look at this: http://developer.android.com/reference/android/graphics/NinePatch.html