Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What image size should I ask from UI developer?

I have an ImageView with these attributes:

   android:layout_width="match_parent"
   android:layout_height="160dp"

UI developer asks me for the size of Image that I want in px. What size should I ask? Should I ask different size for different devices?

Note

I don't have an ImageView with specific height and width. My ImageView width is match_parent not a specific width.

All the answers say that I should use a converter, How can I convert match_parent to px?

According to answers, I should ask about six images, shouldn't I?

like image 525
salmanseifian Avatar asked Aug 01 '18 07:08

salmanseifian


People also ask

What is the best size for images on a website?

2500 pixels width is ideal in most cases. You don't need to resize your images if they're wider than 2500px and meet our other specifications. Images less than 1500px wide may appear blurry. We suggest different widths for site logos, browser icons, email campaigns, and animated .

How many KB should a web image be?

When saving images for the web, we recommend the file size should be less than 2MB (2048 kilobytes) to maintain fast page loading speeds. That being said, we also want images to be sharp and not pixelated.

What size should images be for mobile websites?

On mobile devices, images get resized by the browser anyway, and that 1500px size is enough to look crisp on smartphones with high-PPI “retina” screens too.

What is the best size to save a JPEG?

2400x1600px, jpeg, saved for web, and optimized To ensure that your full width images look good across any device big or small the recommended size is 2400x1600px. Note that devices have different ratio than the one you shoot and it is possible your images will be cropped when viewed on web.


2 Answers

You should give highest screen density in pixels to your UI developer then scale to lower densities on your own.

Normally an android app will support screen densities ldpi at min and xxxhdpi at max.

Step1: If you want the image size is 160 x 160 dp then give the UI developer the highest image size associated with max screen density.

160 x 4 = 640x640 px (why multiply by 4? I will explain later)

Step 2: Scale the image 640x640 px to lower size based on screen densities

  • ldpi: 160 x 0.75 = 120x120 px
  • mdpi: 160 x 1 = 160x160 px
  • hdpi: 160 x 1.5 = 240x240 px
  • xhdpi: 160 x 2 = 320x320 px
  • xxhdpi: 160 x 3 = 480x480 px
  • xxxhdpi: 160 x 4 = 640x640 px

Tips: Find your image size corresponds with mdpi density screen (known as base density or 1X density) then scale to other densities by the following formula

Density buckets

Update: From https://material.io/tools/devices/, screen size for base density screen is 360x640 px. So your ImageView size will be 360x160 px on 1X density screen.

ldpi: 270x120 px 
mdpi: 360x160 px
hdpi: 540x240 px
xhdpi: 720x320 px
xxhdpi: 1280x480 px
xxxhdpi: 1440x640 px
like image 121
Son Truong Avatar answered Oct 28 '22 01:10

Son Truong


Why are you not using Vector drawable?

Why use Vectors?

  1. Data can be represented in original resolution without generalization.
  2. Graphical outputs of the images are more pleasing than the created as raster image
  3. Another very important reason of using vector graphics rather than raster is their size. Vector objects are much smaller than raster image format. If we have the full-size image to update, the vector file might only take few kilobytes of space on your system, where the same image in medium resolution bitmap format might not place on CD ROM.

You should use SVG images in your project.

Create SVG instead of PNG files

like image 39
Mitesh Vanaliya Avatar answered Oct 28 '22 01:10

Mitesh Vanaliya