Home > OS >  How to know the image dimensions in pixels to fit all screens
How to know the image dimensions in pixels to fit all screens

Time:06-30

I'm working on a react native application in a company and my manager asked me what is the best image size in pexels to upload from API (dashboard) to fit the View in the application ?

And I'm using percentage units not numbers: (width: '80%', height: '50%') I don't know what is the best sized of images to fit or the aspect ratio of the image and react native is unitless!

What should we add 'Hint' for the client in the dashboard when he upload any image ? Or how could I know the best image dimensions to fit all screens ?

CodePudding user response:

In case the app target both iOS and Android, there is a multitude of devices with various resolutions and pixel densities from high-end iPads to low-end androids devices with smaller resolutions.

The General rule of thumb is to find the average image size which will not pixelated (look blurry) on the high-end devices but does not have a large download size in case some users will have slow internet.

You should start with 1024 x 768 pixels which is a standard dimension for iPad

CodePudding user response:

Consider using resizeMode prop of react native image. With resizeMode you can manage to render image based on available space in screen.

Check it here : https://reactnative.dev/docs/image#resizemode

  • Related