Android Nine-patch PNG Builder
Generate an uncompiled .9.png source with explicit stretch runs, content padding and a real one-pixel guide border.
Loading tool…
How to use Android Nine-patch PNG Builder
Generate an uncompiled .9.png source with explicit stretch runs, content padding and a real one-pixel guide border. Start with a plain raster and add Android source-asset guide pixels as a separate PNG. Stretch intervals and content padding stay distinct, and the report states their exact source coordinates without pretending to compile or render an Android drawable.
- Provide plain source image without a guide border, stretch intervals and content padding in source pixels.
- Choose the supported mode and run the tool. Review its assumptions and any reported errors.
- Copy the result or download a separate output; reset to clear the current form.
Good to know
- One static non-animated PNG, baseline JPEG or simple VP8/VP8L WebP, at most 8 MiB, 1,000,000 pixels and 2,048 per side. Strict structure/CRC and dimension preflight precedes native decoding; APNG, progressive JPEG, extended/animated WebP, compressed PNG metadata, SVG/GIF and header/native orientation disagreements are refused.
- Guide JSON is at most 10,000 UTF-8 bytes: {stretchX:[start,end],stretchY:[start,end],padding:{left,right,top,bottom}}. Every quantity is an exact plain nonnegative integer; exponent, fractional or lossy near-integer source is refused. Intervals are half-open source-pixel ranges and must be positive inside the source.
- Padding insets must retain a positive content rectangle. Exactly one stretch run per axis and explicit content runs are generated. The output adds two pixels to each source dimension and is capped at 2,048 per side and 1,100,000 pixels. A source already 2,048 pixels wide or tall must be resized first.
- The new border begins transparent: opaque-black top/left runs mark stretchable pixels; bottom/right runs mark the positive content area. Four corners remain transparent. Source pixels are copied into offset (1,1), separate from guide positions.
- Use an unmarked input. Existing .9.png guides, compiled npTc chunks, multiple stretch runs, density buckets, Android build tooling and native drawable rendering are not interpreted. This source generator does not certify distortion-free resizing, contrast, text fit or application acceptance.
- The .9.png artifact still needs a real Android resource build and device rendering check in your own project. No Android SDK, app, resource directory or external service is contacted.
- Native decode waits at most 10 seconds and PNG encoding at most 5 seconds; codec work cannot be forcibly aborted. Bitmap/canvas resources are released on success/failure and late decoded results are closed. Encoded PNG is at most 8 MiB. Native color conversion, premultiplication or re-encoding can change source/hidden transparent bytes or metadata; this is not an archival sample-preservation promise.
- The local pixel module prepares within 10 seconds before ready; a separate 2-second computation deadline applies. Processing uses bounded pixel arrays, not external image services, arbitrary code, mounted user HTML/SVG or uploaded files.
- Structured text output is limited to 500,000 characters. Reduce the supplied source when that separate output budget is exceeded.
- Inputs are processed on this device and are not automatically saved or uploaded.
Common questions
Is this file already a compiled Android NinePatch resource?
No. It is a new uncompiled .9.png source file with visible guide-border pixels. Review those guides, then let your Android resource build process compile and test it. The tool does not interpret an existing compiled NinePatch chunk or emulate Android rendering.
Does this change my original input?
No. The tool returns a separate result. Review that output before using it in another application.
Keep going with related tools
All images →Image Resizer
Resize a PNG, JPEG, or WebP image with an optional aspect-ratio lock.
ImagesSprite Atlas Packer
Pack original raster sprites into atlas PNG pages with a real CSS/JSON coordinate manifest.
ImagesImage Pixel Color Sampler
Read a precise local image pixel’s RGBA values and download a whole-cell magnified patch around that coordinate.