Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

9patch for a lot of resources without losing quality

My designer works on Illustrator and exports all the resources for mdpi, hdpi and xhdpi (and also for iOS res) with a script. For buttons and streachables images, I'm looking for the best solution to generate the 9patches.

Until now, I was using the draw9patch soft in the SDK to generate the 9patches. It still works, but seriously, I hope that there is a better way. If in my project I have 20 buttons, with 3 or 4 states, and in 3 density types, I can't imagine the hours that this solution will require.

A solution would be to use the Asset Studio tool, but I don't want to provide my xhdpi file, and get poorly generated images for the other density folders. My goal is to get pixel perfect 9patches for each density.

We also tried to use SVG files for stretchable images, but it seems that Asset Studio doesn't accept them.

If my designer tries to make the 9patch directly in Illustrator, he can't use the script to export, because the 1 px line will be scaled too, and won't measure 1px anymore.

So is there a solution to make 9patches, without losing image quality, and without spending ten hours for it ?

like image 281
Chayy Avatar asked Jul 13 '12 11:07

Chayy


1 Answers

My solution is to spend a ton of hours learning draw9patch, and then it won't take hours to make the buttons. I did this myself, and suffered, but draw9patch is a really simple way to do it, and each image (for buttons) takes me no more than 15 seconds. draw9patch images should are great because you really only have to do them once, and they will work with all densities, as they will stretch accordingly. If you have text in your images then you have another problem. This is frowned upon because you lose the ability to translate your application with a simple stings.xml

My solution:

1. Get awesome at draw9patch

2. Don't use image's with text. draw9patch can be used to center the text of a button correctly and this will increase the ability of your app to be used in different languages. Something that can easily boost your download/sales. This is important, because even if you give your app the ability to target one more language (let's say... Spanish) then it really makes that target audience happy.

like image 119
EGHDK Avatar answered Sep 20 '22 05:09

EGHDK