# How to use tint() with copy()

**URL:** <https://discourse.processing.org/t/how-to-use-tint-with-copy/12359>\
**Category:** Coding Questions\
**Created:** [June 28, 2019, 1:13pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359 "2019-06-28T13:13:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheWizardBear](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thewizardbear/32/3552_2.png) [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Post date:** [June 28, 2019, 1:13pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359/1 "2019-06-28T13:13:03Z")

</div>

To put a tint on an image you use the tint function followed by the image function like so:

```auto
tint(255, 0, 0);
image(img, 0, 0); //red image

```

But when I try to use the copy function, the tint isn’t applied as it is only ever applied to the image function:

```auto
tint(255, 0, 0);
copy(img, 0, 0, 10, 10, 50, 50, 10, 10); //The part of the image that we moved is still the color of the original image

```

So my question is: How do I use the copy function and still get a tinted image (or part of image)?

I think I need to somehow use the copy function on an edited image (one that looks like it has had tint() applied to it e.g. a red filter like shown above) but I don’t know what the best way to go about changing the color of the actual image is (or if that is even possible / the best thing to do).

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [June 28, 2019, 1:20pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359/2 "2019-06-28T13:20:34Z")

</div>

Try the 9 argument version of image() instead.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 28, 2019, 1:23pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359/3 "2019-06-28T13:23:40Z")

</div>

Or maybe try out **blend()** o **filter()**:

1. [p5js.org/reference/#/p5.Image/blend](http://p5js.org/reference/#/p5.Image/blend)
2. [p5js.org/reference/#/p5.Image/filter](http://p5js.org/reference/#/p5.Image/filter)

---

<div class="post-metadata">

**Author:** ![TheWizardBear](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thewizardbear/32/3552_2.png) [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Post date:** [June 28, 2019, 1:26pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359/4 "2019-06-28T13:26:43Z")

</div>

Thanks. A tiny bit less elegant but it does the same job!

---

<div class="post-metadata">

**Author:** ![TheWizardBear](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thewizardbear/32/3552_2.png) [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Post date:** [June 28, 2019, 1:29pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359/5 "2019-06-28T13:29:56Z")

</div>

I don’t think I am able to tint the image any color with filter(), though.  
And I need another image to blend it with for blend().

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [June 28, 2019, 1:33pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359/6 "2019-06-28T13:33:30Z")

</div>

> [@TheWizardBear](#):
>
> Thanks. A tiny bit less elegant but it does the same job!

How exactly is one extra letter less elegant?! 😄

Stay away from filter, etc. It’ll be slower, much slower if you use P2D/P3D.

---

<div class="post-metadata">

**Author:** ![TheWizardBear](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thewizardbear/32/3552_2.png) [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Post date:** [June 28, 2019, 1:37pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359/7 "2019-06-28T13:37:03Z")

</div>

> [@neilcsmith](#):
>
> How exactly is one extra letter less elegant?! 😄

Haha, I suppose you’re right. It’s just a little easier to understand what it is going on with copy() as you are literally copying a part of the image.  
Also I just needed something other than “thanks” to say to satisfy the minimum 20 character constraint!

---

<div class="post-metadata">

**Author:** ![TheWizardBear](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thewizardbear/32/3552_2.png) [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Post date:** [June 28, 2019, 6:05pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359/8 "2019-06-28T18:05:13Z")

</div>

Sidenote: the part of the image copied from and where that part is placed are in different orders in the image and copy functions.
