简体   繁体   中英

What size of an image should I use to get sharp images?

I am making an app for Android and I am having trouble providing the right resources to the right dpi-folders to make the resource look sharp and not pixelated. I have already made different resources for every folder and they look sharp on my LG G5 but when I am loading the app to my tablet the pictures are smaller and not that sharp.

I am just gonna put the sizes of the different image sizes in here so that no one asks:

mdpi - 54x47 | hdpi - 81x70 | xhdpi - 108x94 | xxhdpi - 162x141

My Tablet uses xhdpi resources and my phone uses xxxhdpi resources.

I've wanted to redo all images so that they would be as sharp as possible. So I took a ruler and messured the size of the image as it should appear on the screen and multiplied it with the dpi to calculate the size of the image.

I came up with this width for the Tablet:

0.866in * 320dpi = 277px

But when I checked and calculated the width of the image for the phone, I got this:

0.413in * 640dpi = 264px

At this point I was confused because the width for the hdpi was larger than the one for the xxxhdpi.

I know that if i had a tablet with 640dpi i would get a image that is bigger than the one with 320dpi, but I still don't know what size the image should be.

Is there maybe another way to categories the images? I saw that screens have different screen sizes (small, normal, large, xlarge), but as far as I know they only determine the layout size. Can anyone help me get sharp images?

I think you have not added image resources for the tablet. For tablet image resources you need to create 5 more folders in your res directory that is

  1. mipmap-sw450dp-mdpi
  2. mipmap-sw450dp-hdpi
  3. mipmap-sw450dp-xhdpi
  4. mipmap-sw450dp-xxhdpi
  5. mipmap-sw450dp-xxxmdpi

For more information please read this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM