adobe-photoshop / generator-assets

Generator Plug-in for Adobe Photoshop CC that helps users export image assets
MIT License
495 stars 87 forks source link

Android 9patch Support - Feature Request #199

Open adamdiestelkamp opened 10 years ago

adamdiestelkamp commented 10 years ago

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 commented 10 years ago

@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 commented 10 years ago

@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.