Android SDK display images on different devices with different screen resolutions - android

I have question that is connected to display images on android devices.
I have many png files that I want to display and they have got 1024 x 768 resolution and have text in image. The text in images must be readable - this is important thing. Because png it is bitmap format I understand that the loss of quality is inevitable. Maybe some one can advice me to choose some approach to solve this issue. Maybe I have to choose just devices that can display those images.
All images like this below:

Related

API - Image Sizes for iOS and Android (Different Screen sizes) - Optimization

Working on an Application that displays images in various sizes as grids, lists (Instagram like), images that take up the whole screen.
Ex. - you might have is a grid view image (not very big), but also this same image is shown in another screen that's almost the size of the entire screen. It's like a blown up version of this. There are also the smaller thumbnails of these images.
Working with the Backend team to come up with an optimal solution.
Questions:
What's the most optimal way to handle images for different screen sizes? I know instagram sends the URLs for high resolution low resolution and thumbnails.
Do we need multiple sizes for each image? example. grid view (do we need a 1x, 2x or 3x) for each image?. or can one size serve all phone screen sizes and we can just set the scale mode in code? Would this be ok even for smaller screen sizes? Would this be a poor experience for smaller phone sizes since they need images. To me this wouldn't be optimal since smaller phones like SE don't have the same processing power as iPhone 8 plus.
If we're using the same API to serve iPhone and Android - how can this api be leverage for android given that they have more image sizes to handle.
Any guidance would be greatly appreciate it.
PREMISE:
You are talking about images from web server. Not svgs, not interface
graphics. There's no official documents of this field, just
suppositions and results of experience. I'm sharing mine.
If you meant interface graphics, there are official documentations from Apple and Google. If you meant svgs, they're automatically scaled. If you intended to have answer for those, please edit the topic or open new ones
A solution could be, instead of acting only on images sizes, to change the quality of JPGs.
You can use a full quality ~200x~200 image for little thumbnails (avatars, photo icons), which could be ok for all devices sizes, resolutions and models, without being too heavy.
Then, for bigger previews/full image opened you could maintain the same size (the original one, or a maximum size you define) but, using two version of the image: one with little JPG quality (so that it can be loaded quickly, consume less bytes and show the image content) and the other with the original quality (which requires loading and bytes, but it's only shown by demand).
To choose the right value of the little thumbnail (the ~200px), check the bigger thumb size you have. If you have an avatar bubble which is 96x96 on smallest res, multiply it for 3 (96*3=288) and you have the size!
It is true that the smallest res screen will only require a 96x96 image, but, given that those are little numbers, the difference is not relevant (also, because we are talking about photos and not vectorial images, if you scale manually or if you leave the scaling to the device, the result is the same).
I've found some documentation from Google, which explains some things about image formats and how to reduce download sizes: https://developer.android.com/topic/performance/network-xfer.html
They say to use JPEGs, PNGs, or WebPs and show some examples and guidelines for choosing the right format
You can use svg resources(which is a vector-based-image) : By doing so, you don't need to generate a resource for each resolution, and just need 1 resource. In realtime, the svg image will expand to the resolution of the device.
According to the documentation, you have a lot to gain here :
Using vector drawables instead of bitmaps reduces the size of your APK
because the same file can be resized for different screen densities
without loss of image quality
I have used this in Android, and it solves your issue in Android.
I Haven't used this in iOS but, it looks like there's a similar solution as well.
Your all questions are nearly have same goal. So Basically save 6 versions of images like 50px 100px 200px 400px 800px and 1600px etc.
6 will be enough since you can cover nearly all screen sizes like google does in android. which is ldpi mdpi hdpi xhdpi xxhdpi and xxxhdpi
Use an API for picture requests, send your screen sizes to api as parameter then give back resulting images width and height. for ex: for a 800x600 screen send back 400px version of it.
If you not do so, you will have to resize them on client size which is bad for performance and also bad approach for auto layout in IOS.
You can use third party image managing solutions like Cloudinary.
https://cloudinary.com/
Cloudinary generates images of different aspect ratio which can be serve to all types of devices.

Poor image quality after downloading from android asset

I'm trying to get an image to fit nicely on each screen size, the image i'm using an image which is 1351 × 2048 and i have used android asset to achieve this. It has worked fine except from the image quality is a lot more poor on all resolution. Images are too large to add to here to show difference.
I've now fixed it, the way around this is to find the correct sizes for each resolution and change this in photoshop to avoid losing quality, then add the correct size to each folder hdpi - xxxhdpi, for some reason the image will lose quality when compressing folders which is what android asset does.

Can I keep fix the same resolution of the same image when the devices have different densities?

I asked a question yesterday.
Why do resolutions become smaller after a image file be read by program?
Very thanks the people helped me.
They let me know that if I use the devices having different densities, the resolutions of the same image may be changed.
For example:
I have a image with resolution 1440x2560 and a device with density 3.5.
The revolution will become 1260x2240 after the image be read into the program.
But I don't want the resolutions of the images to be changed, because the proportion of the images on the screen will be different.
I tried to find a solution, but I failed.
Is there a convenient way to fix the same resolution of the same image on the different devices with different densities?
If you want your images to be adjusted by Android, I understand they are drawables even if you didn't explicitly mention it, add them to the drawable-nodpi directory.

Will adding images in all mdpi/ hdpi/ xhdpi etc increase the size of app for all devices ? - Android

I've read "Supporting Multiple Screens" on the official docs.
I have around 15 activities. I currently have 4 background images. I've randomly assigned a background image to each of the screens in simple XML.
All these images are around 400X800 in the drawable hdpi folder.
Now the problem:
My app looks bad on tablets. The low resolution images are stretched out.. making them very blurry. So, I'm thinking about adding some higher res images.
The question:
So, now I have 4 images in the hdpi folder. (read slowly) ... If I add the same images of higher resolution in the xhdpi folder .... Will a device with screen of hdpi resolution also have to save the other res pics ?
I know that was confusing, below I explain with an example:
Okay, so I have three devices..
One small,
One medium,
One Tablet.
Now I have 3 sets of images in the mdpi, hdpi and xxhdpi.... for each of these.
Now, will the small device's apk file also contain the bigger images which are not used in it? ... I mean, can android choose which images it wants to download (changing the app size for different devices) ...?
Or does it simply download everything (increasing the app size)... and choose later on while running ?
The thing is, my app is like 800kb .... and adding 3-4 background images for large phones or tablets will drive up the app size to 5-6 mb... That's what I don't want.
So, are all the things stuffed in the apk downloaded equally on all phone sizes ? or are the pics downloaded selectively?
Do small phones unnecessarily download the big images too ?(vice-versa for tablets ?)
(I asked this question, because in many android apps , their size says "Variable for different devices" or something like that... and there's no mention of this whatsover, anywhere on the internet. Trust me, I googled for an hour.)
Yes. Your project size will increases whatever images added in all folders. If you are designing for 4 different screen your apk size will increase automatically. If you want any images common for all screens, then you can create a drawable folder and place the image in it. So it will pick automatically. Both apk size and your project quality are important. So you should consider image size when adding to the project. By using padding and other xml factors you can adjust screen size by same image also.
The whole apk is downloaded together with all images for all resolutions. As you usually upload only one file to Google Play, the same file is downloaded by everyone.
There is an option do distribute different apk files based on device onfiguration but it is not very convenient to manage.
You can read about publishing multiple apk in here: http://developer.android.com/google/play/publishing/multiple-apks.html

Background Image Quality

Android Development help please.
Can somone tell me how I might increase the quality of background images in my app? I have been using Photoshop where the images look great, then I save for the web as a png...then add it to my app... Then on the phone the image looks a little blurred.
Whats the best way to increase my image quality?
I would make sure you're saving it at an adequate resolution. I'm will to bet that "save for web" reduces the resolution to 72 dpi which may not be enough for an android handset. In photoshop, try bumping the resolution of the final png to something like 300 dpi and see if that makes a difference. From there you can experiment with different resolutions to figure out what's the smallest value you can use and still have a crisp image. Alternatively, you could just look for the documented resolution requirements.
The apparent quality of your images may also depend in the type of device you are displaying the images on. For example, if your image is saved as 72px x 72px in your image editor, then displayed with a size defined using 72 scaled pixels (sp) in android on a high pixel-density device, then the OS will stretch the image before display. As such, the pixel density of the display device can affect the apparent image quality.
You can provide different resolution images for different pixel densities by using the hdpi, mdpi and ldpi folders for drawables. See these links for more info:
Screens support
Icon design

Categories

Resources