简体   繁体   English

我应该使用什么尺寸的图像来获得清晰的图像?

[英]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. 我正在为Android开发一个应用程序,但无法为正确的dpi文件夹提供正确的资源,以使资源看起来清晰而不会像素化。 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. 我已经为每个文件夹制作了不同的资源,它们在我的LG G5上看起来很清晰,但是当我将应用程序加载到平板电脑上时,图片更小而不清晰。

I am just gonna put the sizes of the different image sizes in here so that no one asks: 我只是将不同图像尺寸的尺寸放在这里,所以没有人问:

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

My Tablet uses xhdpi resources and my phone uses xxxhdpi resources. 我的平板电脑使用xhdpi资源,而我的手机使用xxxhdpi资源。

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. 因此,我拿了一把尺子,弄乱了应该在屏幕上显示的图像大小,并将其乘以dpi以计算图像大小。

I came up with this width for the Tablet: 我为平板电脑设计了以下宽度:

0.866in * 320dpi = 277px 0.866英寸* 320dpi = 277px

But when I checked and calculated the width of the image for the phone, I got this: 但是当我检查并计算手机图像的宽度时,我得到了:

0.413in * 640dpi = 264px 0.413英寸* 640dpi = 264px

At this point I was confused because the width for the hdpi was larger than the one for the xxxhdpi. 在这一点上,我很困惑,因为hdpi的宽度大于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. 我知道如果我有一台640dpi的平板电脑,我会得到比320dpi更大的图像,但是我仍然不知道图像应该是多大。

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. 我看到屏幕具有不同的屏幕尺寸(小,常规,大,xlarge),但据我所知,它们仅决定布局尺寸。 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 对于平板电脑图像资源,您需要在res目录中再创建5个文件夹,即

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

For more information please read this . 有关更多信息,请阅读此内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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