Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 9patch Support - Feature Request #199

Open
adamdiestelkamp opened this issue Mar 13, 2014 · 2 comments
Open

Android 9patch Support - Feature Request #199

adamdiestelkamp opened this issue Mar 13, 2014 · 2 comments

Comments

@adamdiestelkamp
Copy link

Generating icon assets for Android is overall a pretty simple process with generator and the Android DP fork of the generator (https://github.com/jimulabs/generator-assets)

However generating 9patch assets for all resolutions in an efficient automated process I've found to be pretty difficult. I would love to see generator officially support the Android DP unit, and I think 9patch asset generation would be pretty feasible too.

Request to support:

".9.png" - Android 9patch extension
@content - to determine the 1pixel border on the right and bottom that defines the content area
@patch - to determine the 1 pixel border on the left and top that defines the stretchable areas of the image


Sample Image at mdpi resolution:

screen shot 2014-03-13 at 1 27 07 pm

Sample output at mdpi resolution would look like this:

screen shot 2014-03-13 at 1 27 12 pm


The basic process would be to scale the images to the appropriate dimensions and then create an additional 1px empty border on all sides then fill in the one pixel space based on the scaled layer dimensions of @content and @patch.

Issue presented would be that sometimes you could get half pixels when scaling from mdpi to hdpi (150%) or scaling from xxhdpi down to mdpi (33.33%). To avoid this perhaps it could recognize the dimensions and round down to the nearest whole pixel or somehow maintain the snap to pixel grid.

The closest thing out there to this is PNG Express which via a plugin generates the 9patch guides for multiple resolutions. I'm going to download it and give it a try however for a seamless workflow I would love to see this in generator down the road.

@joelrbrandt
Copy link
Contributor

@adamdiestelkamp Thanks for the clearly thought out feature request! I've also added this to our Trello backlog (which, for complicated reasons, is unfortunately not public).

My hunch is this feature would work best with some UI in photoshop -- there's maybe too much information to cram into a layer name. The good news is we're starting to rethink "save for web" workflows right now, so this idea couldn't have come in at a better time.

Also, just so things link up right in github, here's the original PR for DP support: #158, though it seems that @jimulabs is now maintaining a fork.

(cc @lintonye @jimulabs @timriot)

@timriot
Copy link

timriot commented Mar 30, 2014

@adamdiestelkamp I agree with @joelrbrandt that this feature request would be best served via a rethought Save for Web UI, which I plan to begin work on after our next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants