I apologize for the simple question, but I am a bit confused.
I am creating my first Android app. Functinally I am done. I am now working on the UI. According to this, I am required to provide multiple icons to support different screens and I understand this part.
So I created a vector image, and was about to export it to generate a number of icons to support multiple resolutions. However, I could not find the require DPI. According to this, I am supposed to support different DPIs, but the article does not explain how to do that.
Can you please advise me on how to select the proper DPI? Does it even matter? I thought it does, but maybe my understanding is wrong.
Thanks.
EDIT:
Just to clarify my question. When I am exporting an image from a vector to a raster image, I have to select its dimension (so in my case, 400px X 200px), and its dpi. So what should I choose for DPI? Is that the same DPI that will create different icon sizes? I am confused. Thanks again.
For what concerns dpi, I use to follow the screen dpi:
640 dpi for xxxhdpi screens
480 dpi for xxhdpi screens
320 dpi for xhdpi screens
240 dpi for hdpi screens
160 dpi for mdpi screens
120 dpi for ldpi screens
This way I'm sure the icons are appropriate to the screen resolution.
I'm also sure that I can skip some (if not all) the lower qualities, once I have the highest resolution graphics, because they will scale down nearly perfectly.
But, since I'm a perfectionist, nearly disturbs me.
So, I do provide all the resolutions graphics.
For what concerns dimensions use this cheatsheet: http://petrnohejl.github.io/Android-Cheatsheet-For-Graphic-Designers/#dimensions
You can make this experiment:
for an xhdpi screen, prepare a 800px X 400px image at 72 dpi (and no other images for other resolutions) and see how does it scale down in a lower resolution physical device, say an ldpi screen (it will look really bad)...
Then prepare a 800px X 400px image at 480 dpi (and no other images for other resolutions) and, after scaling (will look very good, on the same ldpi screen), compare the result to the previous one.
The difference will be evident on a physical device, much less on an emulator.
It's a way of doing things when you want to save some bytes on lower resolution pictures: just prepare the highest resolutions ones and let Android scale them down (it will scale down the ones it doesn't find in their folders).
I am writing my conclusion for the greater good. After further reading and investigation. It appears that DPI is not important when I am creating an image for a screen. So when I choose 400px X 200px, and assuming this will be for mdpi, then I should choose 800px X 400px for xdpi (and so on and so forth). The dpi should be ignored in all cases (does not matter if I chloose dpi of 90 or 600, as long as this is not for printing). On the other hand, if I am to print the image, then dpi is important.
EDIT
This is a great article about the topic. Please read it, it explains things very well.
Related
I'm making an android App that shows images at full screen.
I learned some about dpi and dp, but I didn't find how many pixel must be the largest side of my images (in prospective to good fit also in landscape mode) to appear good in different devices.
As in the documentation, the most used screen configurations are normal with hdpi, xhdpi and xxhdpi density:
So, if my thinking is correct, I can make only one image to fit the xxhdpi to works fine also with the other two densities, and put it in Android Studio under the "res/drawable" folder (without qualifier).
Specifying the image size in dp in the layout, Android should scale the image for the smaller configurations.
But, for the xxhdpi, how many pixel must be the largest side of my image, in pixel, to show good?
Edit: how many pixel must be the longest side of my image to be showed properly in a device with xxhdpi density without the image appearing grainy?
All images are photo, not icons, so I can't use the vector graphics.
By looking at the Android Documentation. One can estimate the size of the picture. look at below picture
So, your image resolution should be in similar resolution
LDPI: 200 X 320px
MDPI: 320 X 480px
HDPI: 480 X 800px
XHDPI: 720 X 1280px
XXHDPI: 960 X 1600px
XXXHDPI: 1440 x 2560px
A little bit of +/- won't affect the outcome because with these standard sizes the aspect ratio of any portrait picture should be respected.
Well, if you put the image which fits the xxxhdpi inside the folder drawable, then it will fit all the screens.
But there is another way to use only one image instead of using multiple images for different resolutions. It's by using svg images which are vector images that will not be affected by zoom in or zoom out.
To use svg you need to follow these instructions:
Make the icon to be icon.svg
In the Android Studio, right click on drawable folder
Choose New -> Vector Asset
Choose Local File (SVG, PSD)
Choose your svg file
Click Next and choose the name
Click Finish
In the app build.gradle add the following inside android block:
vectorDrawables {
useSupportLibrary true
}
In the xml layout file, add the following:
<AppCompatImageView
android:width="wrap_content"
android:height="wrap_content"
app:srcCompat="#drawable/your_svg_file"
/>
Android have ratios defined for a image to set in all different drawables
Android icons require five separate sizes for different screen pixel densities. Icons for lower resolution are created automatically from the baseline.
mdpi: 160 dpi 1×
hdpi: 240 dpi 1.5×
xhdpi: 320 dpi 2×
xxhdpi: 480 dpi 3×
xxxhdpi:640 dpi 4×
Above size is for normal pixel icons. There are fix android size for Action bar, Dialog & Tab icons, Launcher icons & Notification icons
Check this link for more details http://iconhandbook.co.uk/reference/chart/android/
You have to take a look at the current market of smartphones.
Here you can see the screen sizes and resolutions of the most popular devices in the market.
http://screensiz.es/
Order the list in pixel per inch and you will see that top smartphones have resolutions bigger than 500 ppi or another way to see it, much bigger than 72ppi of your images.
If you have enough space to store or mechanism to download images try to test with full quality. If thats too much try to find a compromise. Lower image quality and see the result in high resolution screen.
Note that you didn't posted here the total size of image, in case is bigger than screen size, take a look at total size of image and compress it to fit your needs, maintaining as much as possible the resolution.
Edit: Looking only to size of image in pixels, the current biggest screen in smartphone is 2560 x 1440 pixels, so you wont need any image bigger than this.
If I understand your answer correctly, you are talking about images (pictures of lovely cats and dogs?) and not about icons?
I prefer putting images into the nodpi folder.
nodpi Resources for all densities. These are density-independent
resources. The system does not scale resources tagged with this
qualifier, regardless of the current screen's density.
Afterwards I would create a fullscreen ImageView and let imageView do the scaling if needed
Ok so I know questions about resources for different densities have already been asked, however I ran into a problem, which is why this question is different. Ok so on the android developers website here http://developer.android.com/training/multiscreen/screendensities.html it's stated to use the scale of 1.0 for mdpi, 1.5 for hdpi, 2.0 for xhpdi, and so forth. But the problem is this scale appears to be wrong. If I make an image that is 480x800 for the nexus 1, it will take up the entire screen. If I divide this by 1.5 to get the mdpi version which is the baseline, I will get 320x533.34 approximately. Now lets try multiplying this by 2.0 to get xhdpi version. You will get 640x1066.68. In other words, on a nexus 4 with xdpi and resolution of 768x1280, the image will NOT take up the whole screen. The scaling is not accurate. So I made an image that takes up the whole screen of the nexus 1, then scaled it according the the scale given by the android developers, and for other screens the image will not take up the whole screen. I want a scale that will give me complete accuracy. Thanks!
In other words, on a nexus 4 with xdpi and resolution of 768x1280, the image will NOT take up the whole screen
It is not supposed to. Density has nothing to do with screen size. I can have an -xhdpi screen that is one inch, one foot, one meter, one mile, or one parsec in diagonal length. Those screens would have drastically different resolutions, but the density would be the same.
MDPI is 1.0 as you said, not 1.5. If you create an image that is 480x800 in the MDPI folder, it will be scaled up to 720x1200 on an HDPI device, or 960x1600 on an XHDPI device. You're never going to get an image which properly fits all screens -- there are just too many aspect ratios and resolutions to do that properly. Try to avoid that design philosophy altogether if possible (e.g. maybe have a nine-patch image in the center with a stretchable region on the edges), or set the image to scale and crop to fit (e.g. scaleType="centerCrop") and keep important parts of the image away from the sides of the screen to allow for some wiggle room.
Well, I'm working on the UI for my Android app. And regarding the variety of screen sizes and resolutions, I'm following the known recipe:
MDPI 160DPI 1X (1px)
HDPI 240 DPI 1.5X
XHDPI 320 DPI 2X
Considering this scale, it means manually resize all my icons and buttons on Photoshop, and then load them into the respective folders (mdpi,hdpi and xdpi).
Do you do this in the same way? There is some sort of "auto scaling mode" or something on Android?
All the best,
If you don't want to generate all the icons for all dpi fragmentation, there's a trick. Just generate the icons for xxhdpi or xhdpi and add them into the respective folder. Android itself will resize them in order to fit another fragmentatios but remember that the scale is always done from bigger sizes to smaller, not in the other way.
Hope that helps
I Need to create a Designs for a Andriod Application.
I can see everyone are speaking about this "ldpi,mdpi,hdpi & xhdpi....etc.," My biggest doubt is in WHAT RESOLUTIONS, I should create the designs in Photoshop?? As there are lots of screen sizes available now. WHAT DEFAULT SCREEN SIZES I SHOULD DESIGN WITH FOR EACH "ldpi,mdpi,hdpi & xhdpi ?" Like for Xhdpi - What Screen resolution Should I do ?
a. 720x1280 - 320 dpi
b. 2048x1536 - 320 dpi
c. 2560x1536 - 320 dpi
d. 2560x1600 - 320 dpi
Again the same resolutions for ldpi,mdpi and hdpi ? What Screen Resolutions for the respective DPI's
Which Screen Resolutions for
a. 120 dpi ?
b. 160 dpi ?
c. 240 dpi ?
PLEASE CLARIFY ME GUYS.
THANKS A TON IN ADVANCE
See this calculator.
ldpi is 120 dpi
mdpi is 160 dpi
hdpi is 240 dpi
xhdpi is 320 dpi
xxhdpi is 480 dpi
xxxhdpi is 640 dpi
(Thanks to Tobor for adding those last two and correcting my typo, I accidentally overwrote his edit)
Also, I don't know why Maneti's initial advice was downvoted. When in doubt, use this tool (or the one in your android sdk) to generate your icons, then import those icons you generated into Photoshop. That's actually the most pragmatic and easiest solution (that doesn't require any thinking on your part and yet that solution works all the time for densities).
As to the size of an image (as defined by the Android guidelines/terminology), only worry about the size of that image if it's a image that could potentially take the entire width, or the entire height, of the screen (like a large background image for instance).
So in most cases, most developers end up not needing the size qualifier for their drawables (because it won't make a difference unless it's a large background image).
For 120, 160, 240 dpi, respectively, I'm condidering 240*320, 320*480 and 480*800 (or 854) screen sizes.
For xhdpi (320) I'm considering 1280*720 (or 800).
But this is only a reference
Take in account that your design should scale
So, the graphical elements should stretch or be repositioned well.
After all, the screen size is not so important, if you project your objects positions and sizes well.
Use dp for objects and sp for font sizes, use the proper dpi resolutions for graphics and you shold be fine.
You can't follow any existing resolution. Generalize.
You could start with with XXHDPI and then export your assets from there. I found that 1080px x 1920px and 72ppi is a comfortable size to design in Photoshop and allows you to export to other resolutions by downscaling (you should avoid scaling assets up). You can then you use this Photoshop script I wrote or Cut&Slice me to export assets from that document to the other resolutions (XHDPI, HDPI, MDPI, and LDPI).
I would also recommend using a Sprite Sheet PSD for your assets to keep things clean and organized.
Hope this helps.
first I think you meant ppi not dpi.
second since the graphics are intended to be used on screen only the size in pixels matters. The ppi could be what ever you want.
ppi (pixels per inch)/dpi (dots per inch) is used to measure the resolution of the output in the real world.
So why people use ppi if it doesn't matter?
Some people like to use the ppi when sizing the files for proportions. This way you can change the ppi number and get the proportions right.
let's assume you start with xxhdpi with a ppi of 480.
Then if you change to 320 you will get xhdpi
240 > hdpi
160 > mdpi
120 > ldpi
but you can use percentages as well.
I have an android app that I'm trying to add support for different densities, screen sizes, etc. I've developed the app on the simulator with the HVGA support and used all icons from our iphone app which turns out nice since the resolution was at 320x480. Everything looks good now but I'm a bit confused after reading the official android documentation. For layouts I'm going through and ensuring everything is in dp units but when it comes to the images I'm lost. I know that mdpi is 160 but what do I tell my designer for what the hdpi image needs to be? Do we need to increase the height and width and the dpi? Or is it simply enough to leave the dpi as is and increase the height width? For example, if I have an image that's 100 x 100 with 160 dpi, in order to render it identical on an hdpi screen it should now be 150 x 150 with 240 dpi? Assuming if I leave the dpi at 160 it will just be a little blurred? Sorry about silly question but I just want to make sure I'm doing everything right and I'm really a C developer with no graphics experience at all.... No excuse at all but could use some help. I saw some examples where the splash screen for mdpi was 320x480 at 160 dpi but then the hdpi splash screen was at 480 x 800 at 240. Obviously 480 x 1.5 does not equal 800. Furthermore, after looking at the icons in the android sdk, they only scale up the width and height, not the dpi. Probably because they're icons and don't need to be? Lost in photoshop land....
For me as a Graphic Artist of a Mobile Development Company, I made UI's for Android in this dimension:
HDPI : 640px x 960px in 300dpi optimized by 75%
MDPI : 640px x 960px in 300dpi optimized by 50%
LDPI : 640px x 960px in 300dpi optimized by 25%
Take a look at Providing Resources.
There is a section there on "Screen pixel density (dpi)". You are correct that you just scale your width and height for the resources. A 90 pixel image at ldpi becomes a 120 px a mdpi, a 180 at hdpi and a 240 ad xhdpi.
You are also right that the 800 isn't 1.5 x the base 480 height. The reason for that is that these are all approximates based on targets for each density. The phone os lies to the applications running on it about its actual height and width and scales the resources to match the exact dimensions of the handset, since it can vary. This is my understanding.
I recently solved this problem by generating many PNGs of different sizes from a SVG vector image. These are the ratios I used for screen pixel densities and screen sizes:
ldpi:mdpi:hdpi:xhdpi:xxhdpi <-> 3:4:6:8:12
sw320dp:sw360dp:sw480d:sw600dp:sw720dp <-> 8:9:12:15:18
Putting these two together can give a 5 by 5 table of image size ratios that you need in make your image resources look great on most Android devices' screens. Of course, the downside is that many images will be generated, and the size of your APK will grow.
Please see http://aleakymemory.blogspot.com/2013/11/a-different-look-at-managing-android.html for the table of image size ratios.
Everything looks good now but I'm a bit confused after reading the official android documentation.
Which documentation did you read? Here are some to be going on with:
Supporting Multiple Screens
Icon Design