Docelora
ToolsAboutContact
Android tools

Nine-Patch Generator

Make chat bubbles, buttons and backgrounds that stretch to any size while keeping their corners and borders sharp.

Quick answer: open a PNG, then set where it may stretch horizontally and vertically. The preview shows the markers and a stretched copy; select Generate to download the .9.png.

Nine-Patch Generator

Stretch areas · padding · live preview

Private: files and text are processed in this browser tab and never uploaded.

The nine parts

PartBehaviour
Four cornersNever stretch
Top and bottom edgesStretch horizontally
Left and right edgesStretch vertically
CentreStretches both ways

Related tools

Frequently asked questions

What is a nine-patch image?

An Android PNG with a one-pixel border of black marks that tell the system which parts may stretch and where content goes. The image is divided into nine parts: corners stay fixed, edges stretch in one direction and the centre stretches in both.

What do the four marker lines mean?

Top: horizontal stretch area. Left: vertical stretch area. Bottom and right (optional): the content area where text or child views are placed.

Why must the file end in .9.png?

The build tools recognise nine-patches by that suffix and remove the marker border when packaging. Refer to the image without .9 – as @drawable/name.

Can I use a JPG?

Open any image; the output is always PNG, which nine-patches require.

Where should the stretch area be?

Over plain areas of the image – usually the middle of each edge – so stretching does not distort details such as rounded corners or icons.

Do I need nine-patches today?

For simple shapes, shape drawables or vectors are often better. Nine-patches remain useful for bitmap backgrounds with texture, shadows or detailed borders.

Can my image already have a border?

No – open the plain artwork; the tool adds the transparent one-pixel border with the markers.

How large can the image be?

Up to 4,096 px on each side. Small images are best – a nine-patch stretches, so it does not need to be large.

Why does the preview look blurry?

The marker preview is enlarged with sharp pixels so you can see the lines; the stretched preview shows real Android-style scaling.

Does it work for Jetpack Compose?

Yes – load it with painterResource like any drawable.

Is it free?

Yes – no sign-up, no limits and no watermark.

Is my file or text uploaded?

No. Everything is processed in this browser tab; nothing is sent to Docelora or anyone else.

Does it work on a phone or tablet?

Yes – the layout adapts to small screens, though large files and long code are easier on a computer.

Do I need Android Studio or Xcode?

No – the tool runs in any modern browser, so you can use it on Windows, macOS, Linux or ChromeOS.

How do I copy the result?

Use the Copy button under the result, or Download to save it as a file.

Which browsers are supported?

Current versions of Chrome, Edge, Firefox and Safari.

Is my input kept after I close the page?

No – copy or download the result before closing the tab.

Can I use the output in commercial apps?

Yes. What you create is yours to use in any project.

Is Docelora affiliated with Google, Apple or Huawei?

No. Docelora is independent; product names are used only to describe compatibility.

Can I suggest an improvement?

Yes – use the Contact page to tell us what would make the tool more useful.

Last reviewed: 16 November 2026.