Skip to content

How to Create 9 Patch Images

MarcusJT edited this page Jul 16, 2012 · 5 revisions

To create a 9 patch image you need to start with a .png or a .gif file. Jpeg's don't make good 9 patch images because they blur colors.

  • Create the image that you would like to scale.
  • Reduce it to the smallest pieces possible.
  • Increase the canvas size to add a 1 pixel border around the entire image
  • Mark the different pieces with the appropriate colors in the border.
  • Save the image as [image-name].9.png or [image-name].9.gif

See also the Android developer info about 9-patch images: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

Clone this wiki locally