redwarp/9-Patch-Resizer

Why image density doesn't change?

Closed this issue · 4 comments

Hi guys,

thanks for this very useful tool.

Question is very simple: why the generated images has the same density? Each folder (hdpi, xhdpi, xxhdpi, ecc) should be a different density, but generated images have different size but same density, in fact images are not sharp.

I hope someone can answer.
Thanks

Giulio

Well, this information is not used by Android. What's important for Android is to have an image of different size in different densities folder. The resolution is written in a chunk of the png that is typically removed when you optimise a .png (with tools such as ImageOptim - https://imageoptim.com/ or PNGCrush - http://pmt.sourceforge.net/pngcrush/). It's meta information.
As I have no use of it, I didn't bother with it. Do you need such a thing ?

Typically, the density information is only used for printing an image. Otherwise, it's useless (as far as I know)

Thanks for answer.

So I don't worry about density. In other words to obtain best result with this tool I have to start from xxxhdpi and generate others sizes, right?

Well, Cyril Mottier (a really competent Android developer) writes a blog about Android development, and in his latest article, he speaks about apk sizes, densities and stuff like that : http://cyrilmottier.com/2014/08/26/putting-your-apks-on-diet/
To sums things up, choose the densities that suit your needs.
The official Android recommandations are to support xhdi, hdpi and mdpi (If you create a new project from scratch in intelliJ, the default icons are in these densities). It states also that the application homescreen icon should be one density highter : which means, xxhdpi.

But the new high end devices are effectively with xxhdpi screens, so you could provide the icon in xxxhdpi, and provides other resources in xxhdpi and less. It's really up to you, really. But yeah, the image resolution ? Only for print.