How to create patterns like these:

From a single image in PHP with GD?
I’ve tried a lot but I think it can be done easier.
My thoughts:
Fill with imagefilledrectangle for one line. For the second line fill it with a margin left and right (for my first example). Next cut the image in two pieces and fill the margins with it and repeat this for each line.
I hope someone can help me out 🙂
Thanks!


Sorry for my late respons, meanwhile I’ve used Imagick for this, with the follow effects: