Tested tool guide
Tested browser tools
Checked August 16, 2026
What 9-Patch Image Generator does, with a checked example
This tool takes an image you provide, lets you mark which rows and columns should stretch when Android resizes the drawable, and lets you mark a separate content-padding box for where text or child views should sit. On export it adds the mandatory 1-pixel border and writes the black marker pixels Android's resource compiler reads at build time, then saves the file with the .9.png extension the platform requires. The detail people miss most: if you skip the padding marks (bottom and right edge) entirely, Android does not leave padding undefined - it defaults to match the stretch region marked on the top and left edge, so a plain button often needs only the stretch marks drawn to get sane content padding for free. Draw explicit padding marks only when the content box needs to differ from the stretch region.
Worked example
A concrete input and expected output from the current implementation.
Input
a flat 20x20px blue square PNG, with the middle row and middle column each marked as the single stretchable region, and no content padding set
->
Expected output
a 22x22px PNG - the original 20x20 artwork centered, surrounded by a 1px transparent border - with a single black pixel at the top edge above the marked column and a single black pixel at the left edge beside the marked row; the bottom and right edges stay fully transparent because no padding was set
9-patch format always adds exactly 1px on each side; black segments on the top/left border tell Android which pixel columns/rows to repeat when stretching, and an all-transparent bottom/right border means content padding defaults to the same as the stretch region.