How to improve resolution of image on Android - android

I have uploaded an image which is on 3000 by 3000 pixel onto Android Studios.
When I try to add the image to my application, the image does not look sharp.
Here is my XML code
<ImageView
android:layout_width="match_parent"
android:layout_height="200dip"
android:scaleType="fitCenter"
android:contentDescription=""
android:layout_marginTop="20dip"
android:layout_marginBottom="28dip"
android:src="#mipmap/login_logo" />
I believe that my image should be big enough for the image view. Can anyone advise me on how to increase the resolution of my image?
Updated
When I uploaded the image, the 4 different versions of the image were created automatically in the system

The problem is that you are creating an icon set, wich actually does not have 3000 by 3000 pixel. Check it.
The application is using the more appropiate size (hdpi, xhdpi, etc). But you are resizing manually. That's why the icon is not sharp in the screen.
When you create a manual Image Asset, this is the real size depending on screen size. The assistan takes the original image and resizze it.
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
In pixels:
36x36 (0.75x) for low-density
48x48 (1.0x baseline) for medium-density
72x72 (1.5x) for high-density
96x96 (2.0x) for extra-high-density
144x144 (3.0x) for extra-extra-high-density
192x192 (4.0x) for extra-extra-extra-high-density
You can solve it, creating your custom image asset following this instructions:
LDPI - 0.75x
MDPI - Original size you want to show
HDPI - 1.5x
XHDPI - 2.0x
XXHDPI - 3x
XXXHDPI - 4.0x
https://developer.android.com/guide/practices/screens_support.html
Or you can use an external library, like Picasso, to load the original image and fit it. The result will be more professional as far as you can dynamically fit, use placeholders, errorimage, etc.
https://www.google.es/?ion=1&espv=2#q=picasso%20android
Picasso.with(getActivity())
.load(new File("path-to-file/file.png"))
.into(imageView);

I suggest a method which use in onCreate() function. It used BitmapFactory to load your image
Options options = new BitmapFactory.Options();
options.inScaled = false;
Bitmap source = BitmapFactory.decodeResource(a.getResources(), path, options);
ImageView mImg;
mImg = (ImageView) findViewById(R.id.imageView);
mImg.setImageBitmap(source);

Related

Android splash screen image that occupies full screen width and height

I am trying to create a splash screen image that scales well for each screen size.
I am trying to determine if I am misunderstanding how pixel densities function.
According to the documentation,
To create alternative bitmap drawables for different densities, you
should follow the 3:4:6:8:12:16 scaling ratio between the six primary
densities. For example, if you have a bitmap drawable that's 48x48
pixels for medium-density screens, all the different sizes should be:
36x36 (0.75x) for low-density (ldpi)
48x48 (1.0x baseline) for medium-density (mdpi)
72x72 (1.5x) for high-density (hdpi)
96x96 (2.0x) for extra-high-density (xhdpi)
144x144 (3.0x) for extra-extra-high-density (xxhdpi)
192x192 (4.0x) for extra-extra-extra-high-density (xxxhdpi)
Now, I take this to mean that a 192x192 image will occupy the same amount of screen space on an xxxhdpi display as a 48x48 pixel image on a standard display.
That means that if I want a full screen image for a Google Pixel 2 display which is 1080px by 1920px and has an xxhdpi density of 2.6 then I need an image that is 1080 * 2.6 = 2808px by 1920 * 2.6 = 4992px.
Is this logic correct?

Creating Android resource images sizes

So I need to create images to be part of my app that I'm making. I haven't found the answer anywhere.
What I am wondering is...
If I created an image that is to be displayed on Activity1, then what image size in PIXELS should I created the initial image at?
The initial image would then be resized to their corresponding DPI to work well on Android phones.
I may be doing this wrong in creating images so they don't lose their quality, any ideas?
If I am doing this wrong, then please can someone advise on the best practice on creating Android images in pixels and then converting to DPI later after the initial image?
Thank you! :)
EDIT: This question is different because I'm mainly talking about keeping image quality by making the image big first and then downsizing.
You have to create six generalized size image densities:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
For more detail check out this link
To generate image for Android device you can follow this as I do:
To create alternative bitmap drawables for different densities, you should follow the 3:4:6:8:12:16 scaling ratio between the six generalized densities. For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:
36x36 (0.75x) for low-density
48x48 (1.0x baseline) for medium-density
72x72 (1.5x) for high-density
96x96 (2.0x) for extra-high-density
144x144 (3.0x) for extra-extra-high-density
192x192 (4.0x) for extra-extra-extra-high-density (launcher icon
only; see note above)
​Or,
Image resolution and DPI are tightly coupled each other. There is a 3:4:6:8 scaling ratio in drawable size by DPI.
LDPI - 0.75x
MDPI - Original size
HDPI - 1.5x
XHDPI - 2.0x
XXHDPI - 3x
XXXHDPI - 4.0x ​
For example if a 100x100 image is a baseline (MDPI),
LDPI - 75x75
HDPI - 150x150
XHDPI - 200x200
XXHDPI - 300x300
XXXHDPI - 400x400
and so on.
​​

How to know the image sizes to design for hdpi, xhdpi, nodpi, etc

I want to design custom images for my app but I'm confused how the image resolutions should differ in the different drawable folders.
Assuming I designed a 100px by 100px image for hdpi, what should be the resolution of xhdpi, xxhdpi, nodpi, etc.
To create alternative bitmap drawables for different densities, you should follow the 3:4:6:8:12:16 scaling ratio between the six generalized densities. For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:
36x36 (0.75x) for low-density
48x48 (1.0x baseline) for medium-density
72x72 (1.5x) for high-density
96x96 (2.0x) for extra-high-density
180x180 (3.0x) for extra-extra-high-density
192x192 (4.0x) for extra-extra-extra-high-density (launcher icon only; see note above)
Hope this will help you.
Hope that can help you !
http://hpics.li/5197929
let us know

Android Export Cropping When XXHDPI Taken as Baseline 100% In Photoshop Then How to crop means size of XHDPI, HDPI, MDPI, LDPI

Android Export
XXHDPI - 100% baseLine
XHDPI - ?
HDPI - ?
MDPI - ?
LDPI - ?
Plz say anyonce of these sizes
I'm not sure, but don't you need the resolutions of the images?
If so, may I link you to Android Developer support?
You can get a lot of information here:
A set of six generalized densities:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
To create alternative bitmap drawables for different densities, you should follow the 3:4:6:8:12:16 scaling ratio between the six generalized densities. For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:
36x36 (0.75x) for low-density
48x48 (1.0x baseline) for medium-density
72x72 (1.5x) for high-density
96x96 (2.0x) for extra-high-density
180x180 (3.0x) for extra-extra-high-density
192x192 (4.0x) for extra-extra-extra-high-density (launcher icon
only; see note above)
Image example:
Now, lets post this, and calculate the rest!
Edit:
I made a simple calculation with Excel

Android layout design for small,medium and big screens

My app is almost done , but the problem is that it's layout has been designed only for small screens by now
and
I want to make it for other sizes ,too
I mean to use drawables with higher resolutions in bigger screens
how should I manage it?
You can use this tool Android Asset Studio to generate drawables for different screens.This tool provides many things like drawables for ActionBar, Launcher, Tabs icons etc.
http://romannurik.github.io/AndroidAssetStudio/
You can make different size of images and put them in their respected folder to support multiple screens in android.
If you are using eclipse you can see different types of folders in your drawable which support different screens:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
these are respectively used for high, very high and low screen images. You can get more info at:
http://developer.android.com/guide/practices/screens_support.html
Here is some documentation for that: http://developer.android.com/guide/practices/screens_support.html
For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:
36x36 (0.75x) for low-density
48x48 (1.0x baseline) for medium-density
72x72 (1.5x) for high-density
96x96 (2.0x) for extra-high-density
180x180 (3.0x) for extra-extra-high-density
Also I recommend "Asset resizer" app for mac, is really useful for get all the sizes from each image.

Categories

Resources