0

I want to stretch images, while preserving 4 corners intact. Similar stuff in iOS is setting capInsets, for UIImage.

Stanley 시크 Yeo
  • 159
  • 1
  • 1
  • 8

1 Answers1

1

Imagine a hash symbol (tic-tac-toe grid) on your image, with the corner squares being the part you don't want to distort.

  1. Divide your image into 3 subimages at the vertical lines with the -crop option.
  2. Stretch (or compress) the middle image horizontally.
  3. Reassemble the 3 parts into one image (+append)
  4. Divide the image into 3 subimages at the horizontal lines with -crop.
  5. Stretch the middle piece vertically.
  6. Reassemble (-append).
Glenn Randers-Pehrson
  • 11,940
  • 3
  • 37
  • 61