# Wrap Text to Shapes

**URL:** https://discourse.processing.org/t/wrap-text-to-shapes/18756
**Category:** Coding Questions
**Created:** [March 17, 2020, 11:50pm UTC](https://discourse.processing.org/t/wrap-text-to-shapes/18756 "2020-03-17T23:50:37Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![robdin](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@robdin](https://discourse.processing.org/u/robdin)
#### Post date: [March 17, 2020, 11:50pm UTC](https://discourse.processing.org/t/wrap-text-to-shapes/18756/1 "2020-03-17T23:50:37Z")

</div>

Hello,  
I’m traying to wrap a image to shape. I see that i can do it with a shape and a texture. The only problem is that textureWrape([textureWrap() / Reference / Processing.org](https://processing.org/reference/textureWrap_.html)) seems to works only on a beginshape and i want to use it on a svg shape.

The effect that i want to have is this:

[![](https://img.youtube.com/vi/GCHsva6ISa4/maxresdefault.jpg "Wrap Text to Shapes Illustrator Tutorial") ](https://www.youtube.com/watch?v=GCHsva6ISa4)

Could you help me?

```auto
BlockquotePImage myImg;
PShape bot;

void setup() {
  size(1000, 1000, P2D);
  
   textSize(240);
  textAlign(CENTER);
  text("Sparks", width/2, height/2);
  
  
  myImg = get();
  myImg.resize(10,10);
  bot = loadShape("tcp.svg");
  

}
void draw() {
  bot.disableStyle();
  background(230);
    textureMode(NORMAL);
  translate(width/2, height/2);
 TextureWrap(CLAMP);  
  bot.setTexture(myImg);
  shape(bot,-100,-400,100,100);
}

```

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [March 28, 2020, 4:38pm UTC](https://discourse.processing.org/t/wrap-text-to-shapes/18756/2 "2020-03-28T16:38:28Z")

</div>

One approach is to use the Geomerative library to transform your text into points, then warp the points.

[http://www.ricardmarxer.com/geomerative/](http://www.ricardmarxer.com/geomerative/)

[https://discourse.processing.org/search?q=geomerative](https://discourse.processing.org/search?q=geomerative)

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [March 28, 2020, 5:22pm UTC](https://discourse.processing.org/t/wrap-text-to-shapes/18756/3 "2020-03-28T17:22:40Z")

</div>

Another approach would be to take a 2D image of the text or whatever then apply this as a texture to a rectangular grid of vertices. Then recalculate the grid vertices based on some contour.

---

<div class="post-metadata">

### Author: ![robdin](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@robdin](https://discourse.processing.org/u/robdin)
#### Post date: [April 1, 2020, 8:10pm UTC](https://discourse.processing.org/t/wrap-text-to-shapes/18756/4 "2020-04-01T20:10:59Z")

</div>

i know this library, but i think wrapping points need a transformation, and i don’t know it.

---

<div class="post-metadata">

### Author: ![robdin](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@robdin](https://discourse.processing.org/u/robdin)
#### Post date: [April 1, 2020, 8:11pm UTC](https://discourse.processing.org/t/wrap-text-to-shapes/18756/5 "2020-04-01T20:11:42Z")

</div>

this sounds good to me, thanks a lot!

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [April 1, 2020, 8:15pm UTC](https://discourse.processing.org/t/wrap-text-to-shapes/18756/6 "2020-04-01T20:15:52Z")

</div>

> [@robdin](#):
>
> i think wrapping points need a transformation, and i don’t know it.

If what you want is to implement an envelope distort, you might be interested in these related discussions:

- [http://lonetechie.com/2013/12/28/envelope-distortion-using-c-and-graphicspath-class/](http://lonetechie.com/2013/12/28/envelope-distortion-using-c-and-graphicspath-class/)
- [Warping arbitrary coordinates? · Issue #11 · benjamminf/warpjs · GitHub](https://github.com/benjamminf/warpjs/issues/11)

---

<div class="post-metadata">

### Author: ![robdin](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@robdin](https://discourse.processing.org/u/robdin)
#### Post date: [April 1, 2020, 8:22pm UTC](https://discourse.processing.org/t/wrap-text-to-shapes/18756/7 "2020-04-01T20:22:46Z")

</div>

A lot of maths 😃 tnx for this references, the second one is good for me 🙂 tnx man. I’ll try to code it!
