I want to stretch images, while preserving 4 corners intact. Similar stuff in iOS is setting capInsets, for UIImage.
Asked
Active
Viewed 92 times
1 Answers
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.
- Divide your image into 3 subimages at the vertical lines with the -crop option.
- Stretch (or compress) the middle image horizontally.
- Reassemble the 3 parts into one image (+append)
- Divide the image into 3 subimages at the horizontal lines with -crop.
- Stretch the middle piece vertically.
- Reassemble (-append).

Glenn Randers-Pehrson
- 11,940
- 3
- 37
- 61
-
you are right. I just wondered if there's more neat way to do it. – Stanley 시크 Yeo Mar 07 '14 at 08:22
-
I tried a couple of things like the new "-distort shepard" feature but did not get the result I expected. I'm sure my 6-step procedure could be reduced to one ImageMagick commandline. – Glenn Randers-Pehrson Mar 07 '14 at 13:51