# Please help on copying pixels between two PImage

**URL:** <https://discourse.processing.org/t/please-help-on-copying-pixels-between-two-pimage/24350>\
**Category:** Coding Questions\
**Created:** [October 5, 2020, 7:41am UTC](https://discourse.processing.org/t/please-help-on-copying-pixels-between-two-pimage/24350 "2020-10-05T07:41:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![datacolor](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@datacolor](https://discourse.processing.org/u/datacolor)\
**Post date:** [October 5, 2020, 7:41am UTC](https://discourse.processing.org/t/please-help-on-copying-pixels-between-two-pimage/24350/1 "2020-10-05T07:41:03Z")

</div>

I have two images in two PImage the first image ( 1.jpg) consists of colored mosaics, while the second image also (2.jpg) consists only of a succession of pixels of a single color on a black background.  
Well, what I’m trying to do and I still can’t quite figure it out, is to linearly copy a number of color pixels from the first image to the succession of single color pixels located in the second image, these successive pixels may not be linearly located In the second image, in fact they could form a curvilinear path. Some example would help me where with the mouse pointer you can select the beginning and end of the linear capture of pixels from the first image.

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [October 5, 2020, 9:45am UTC](https://discourse.processing.org/t/please-help-on-copying-pixels-between-two-pimage/24350/2 "2020-10-05T09:45:33Z")

</div>

You’ll want to take a look at

Loadpixels and update pixels

> **[loadPixels() / Reference](https://processing.org/reference/loadpixels_)**
>
> Loads the pixel data of the current display window into the pixels\[\] array. This function must always be called before reading from or writing to pixels\[\]. Subsequent changes to the disp…

Remember each pixel value holds an rgba value.

You can get the red of a pixel by using red(img.pixels[location])

The same can be done with the others

[![](https://img.youtube.com/vi/nMUMZ5YRxHI/hqdefault.jpg "11.3: The Pixel Array - p5.js Tutorial") ](https://www.youtube.com/watch?v=nMUMZ5YRxHI)

---

<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:** [October 5, 2020, 10:34am UTC](https://discourse.processing.org/t/please-help-on-copying-pixels-between-two-pimage/24350/3 "2020-10-05T10:34:07Z")

</div>

Hello,

I did an exploration of pixels and image in this topic:  
[https://discourse.processing.org/t/using-pixels-array-over-points-trying-to-moving-pixels-xy-off-screen-like-points/24309/2](https://discourse.processing.org/t/using-pixels-array-over-points-trying-to-moving-pixels-xy-off-screen-like-points/24309/2)

It may give you some insight.

`:)`

---

<div class="post-metadata">

**Author:** ![datacolor](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@datacolor](https://discourse.processing.org/u/datacolor)\
**Post date:** [November 19, 2020, 11:57pm UTC](https://discourse.processing.org/t/please-help-on-copying-pixels-between-two-pimage/24350/4 "2020-11-19T23:57:15Z")

</div>

Very thanks!!!the code train videos is the best!

---

<div class="post-metadata">

**Author:** ![datacolor](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@datacolor](https://discourse.processing.org/u/datacolor)\
**Post date:** [November 19, 2020, 11:58pm UTC](https://discourse.processing.org/t/please-help-on-copying-pixels-between-two-pimage/24350/5 "2020-11-19T23:58:49Z")

</div>

Very thank!!the code train is the best option for learning manipulation pixels!!
