redwarp/9-Patch-Resizer

How do I choose the source input density?

yahya-uddin opened this issue · 4 comments

I have an image of resolution 1376 x 1361 with DPI of 72.

What source input density do I choose? How do I decide?

You probably should not. This is a high resolution image, keep only one in the drawable-nodpi folder because I assume it's a jpg.

You should provide density dependent images for icons. A icon has typically a size of 48x48 pixel in mdpi, 72x72 in hdpi, 96x96 in xhdpi and 144x144 pixel in xxhdpi.

So if you wanted to create an icon image, you would design a png file of 144x144 pixel, then resize it with the tool to have the different densities that look good.

And it would have to be a multiple of the mdpi size of course (because, math, pixel perfect, etc)

In you case... probably not what you want to do.

Thanks for the quick response.
Its actually a high resolution 9-patch PNG logo, which I am planning to use for the splash screen, NOT a JPEG image.

Well, it really depends on the size you want at the end. You should read the guide about densities: https://developer.android.com/training/multiscreen/screendensities.html

Anyway, you should never upscale an image, always downscale. So if you want to create other densities, you should pick as input source the highest you want (probably xxhdpi)

Which also means your input file should be redimensioned. 1376 x 1361 cannot be divided reliably.

Let's say your input is xxhdpi, then it's x3 the size of mdpi, x2 the size of hdpi and x1.5 the size of the xhdpi.

So the dimensions of your images should be a multiple of 6, so they can be resized properly (you cannot divide a pixel). Your original image should probably be 1380 x 1362 then. so that it keeps its ratio in every densities.

Great that's really helpful. I imagine this would be helpful for other people as well so maybe put it on the readme or even on the program it self somewhere as reference.