# Convert text to PShape?

**URL:** <https://discourse.processing.org/t/convert-text-to-pshape/15552>\
**Category:** Coding Questions\
**Created:** [November 16, 2019, 8:27pm UTC](https://discourse.processing.org/t/convert-text-to-pshape/15552 "2019-11-16T20:27:17Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 16, 2019, 10:30pm UTC](https://discourse.processing.org/t/convert-text-to-pshape/15552/2 "2019-11-16T22:30:55Z")

</div>

Hello,

[https://processing.org/reference/PShape.html](https://processing.org/reference/PShape.html)  
[https://processing.org/reference/PImage.html](https://processing.org/reference/PImage.html)  
[https://processing.org/reference/texture\_.html](https://processing.org/reference/texture_.html)  
[https://processing.org/reference/textureMode\_.html](https://processing.org/reference/textureMode_.html)

From the references above I was able to:

```auto
// https://processing.org/reference/PGraphics.html
// https://processing.org/reference/texture_.html

PGraphics pg;
PImage pi;

public void settings()
  {  
  size(400, 400, P3D); 
  }

public void setup() 
  { 
  pg = createGraphics(100, 100);
  
  pg.beginDraw();
  pg.background(100);
  pg.fill(255, 255, 0);
  pg.textAlign(CENTER, CENTER);
  pg.textSize(18);
  pg.text("0", 0+10, 0+10);
  pg.text("1", 100-10, 0+10);
  pg.text("2", 100-10, 100-10);
  pg.text("3", 0+10, 100-10);
  pg.save("image.png");
  pg.endDraw();
  
  pi = loadImage("image.png");
  }

public void draw() 
  {
  image(pi, 200, 200);
  
  noStroke();
  beginShape();
  textureMode(IMAGE);
  texture(pi);
  vertex(0, 0, 0, 0); 
  vertex(100, 0, 100, 0);
  vertex(100, 100, 100, 100);
  vertex(0, 100, 0, 100);
  endShape();  
  }

```

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/586eebfb7bc0673fe02f2b03c70c4fa1fb3d7a6e.png)

🙂

---

_[View the full topic](https://discourse.processing.org/t/convert-text-to-pshape/15552)._
