# How to copy clipped rect of an image to another filename?

**URL:** https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054
**Category:** Beginners
**Created:** [October 3, 2022, 9:59am UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054 "2022-10-03T09:59:28Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![bhaskar1955](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@bhaskar1955](https://discourse.processing.org/u/bhaskar1955)
#### Post date: [October 3, 2022, 9:59am UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/1 "2022-10-03T09:59:28Z")

</div>

\</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)  
I think the topic name is self-explanatory. Please help me.

---

<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 3, 2022, 10:44am UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/2 "2022-10-03T10:44:53Z")

</div>

Look up the references for these:

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/b/1bd17816746979edaf415842bed6e0a18e16876a.png)

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/5/4/549ce058aa06c7eba3198423095e93a0c1c40706.png)

They are self explanatory.

`:)`

---

<div class="post-metadata">

### Author: ![bhaskar1955](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@bhaskar1955](https://discourse.processing.org/u/bhaskar1955)
#### Post date: [October 3, 2022, 2:59pm UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/3 "2022-10-03T14:59:15Z")

</div>

Thanks, @glv, but it is saving the entire frame. I want to save only the clipped portion of the image.  
Regards.

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [October 3, 2022, 3:17pm UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/4 "2022-10-03T15:17:26Z")

</div>

Hi

> <https://stackoverflow.com/questions/27839913/in-processing-how-can-i-save-part-of-the-window-as-an-image>

---

<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 3, 2022, 5:37pm UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/5 "2022-10-03T17:37:35Z")

</div>

> [@bhaskar1955](#):
>
> it is saving the entire frame. I want to save only the clipped portion of the image.

You must use the correct syntax for `get()` to _get_ a section of an image.

Find the reference for `get()` and it will elaborate on this

The same applies for a PImage save.

As a beginner it is important to become familiar with the resources available to you.

Resources here:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology…

`:)`

---

<div class="post-metadata">

### Author: ![bhaskar1955](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@bhaskar1955](https://discourse.processing.org/u/bhaskar1955)
#### Post date: [October 3, 2022, 5:53pm UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/6 "2022-10-03T17:53:25Z")

</div>

Thanks a lot. I think with correct syntax of get() and Pimage.save() I can achieve desired result.  
Regards.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [October 3, 2022, 9:09pm UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/7 "2022-10-03T21:09:53Z")

</div>

PImage new1 = oldImg1. get(30,200,60,60);

new1.save(…);

---

<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 3, 2022, 9:25pm UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/8 "2022-10-03T21:25:03Z")

</div>

Hello,

> [@bhaskar1955](#):
>
> I think with correct syntax of get() and Pimage.save() I can achieve desired result.

You certainly will!

References:  
[PImage / Reference / Processing.org](https://processing.org/reference/PImage.html) \< get() and save() for a _PImage_ are in there!

There are two references for get():

- [https://processing.org/reference/get\_.html](https://processing.org/reference/get_.html) \< Use for image on sketch canvas!
- [https://processing.org/reference/PImage\_get\_.html](https://processing.org/reference/PImage_get_.html) \< Use for PImage directly!

If you want to explore further there is a tutorial on _Images and Pixels_ and _Render Techniques_

`:)`

---

<div class="post-metadata">

### Author: ![bhaskar1955](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@bhaskar1955](https://discourse.processing.org/u/bhaskar1955)
#### Post date: [October 5, 2022, 6:10am UTC](https://discourse.processing.org/t/how-to-copy-clipped-rect-of-an-image-to-another-filename/39054/9 "2022-10-05T06:10:52Z")

</div>

Thanks and regards, @glv,  
It worked well. I have achieved the desired result.  
Soon I’ll present the synopsis of my undergoing App. I hope, you will guide me.  
Thanks for everything.
