# Can you resize an image and only show the new Image

**URL:** <https://discourse.processing.org/t/can-you-resize-an-image-and-only-show-the-new-image/39472>\
**Category:** Coding Questions\
**Created:** [October 28, 2022, 2:44pm UTC](https://discourse.processing.org/t/can-you-resize-an-image-and-only-show-the-new-image/39472 "2022-10-28T14:44:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kalarila](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@Kalarila](https://discourse.processing.org/u/Kalarila)\
**Post date:** [October 28, 2022, 2:44pm UTC](https://discourse.processing.org/t/can-you-resize-an-image-and-only-show-the-new-image/39472/1 "2022-10-28T14:44:40Z")

</div>

> please format code with \</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)

Hi, so I have an easy question (I think). I’m trying to show an image and then resize it. Is there a way to only display the resized image and not the original?  
(This is probably a dumb question, but I’ve tried everything I can and haven’t found anything on the internet either)

---

<div class="post-metadata">

**Author:** ![debxyz](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@debxyz](https://discourse.processing.org/u/debxyz)\
**Post date:** [October 28, 2022, 4:04pm UTC](https://discourse.processing.org/t/can-you-resize-an-image-and-only-show-the-new-image/39472/2 "2022-10-28T16:04:06Z")

</div>

The short answer is **yes** , you can resize an image to show only the new image.  
But I think a little more information is required for a good answer.  
For example, in what manner do you want to resize the object?  
Do you want it to be timing based?  
Please elaborate a bit more.

🤓

---

<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 28, 2022, 5:31pm UTC](https://discourse.processing.org/t/can-you-resize-an-image-and-only-show-the-new-image/39472/3 "2022-10-28T17:31:18Z")

</div>

Hi

Many ways to do that

[![](https://img.youtube.com/vi/-f0WEitGmiw/hqdefault.jpg "10.1: Intro to Images - Processing Tutorial") ](https://www.youtube.com/watch?v=-f0WEitGmiw&t=614s)

---

<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 28, 2022, 10:39pm UTC](https://discourse.processing.org/t/can-you-resize-an-image-and-only-show-the-new-image/39472/4 "2022-10-28T22:39:52Z")

</div>

@Kalarila  
Hi with boolean you can

```auto
boolean show= true;
PImage flower;

void setup() {
  size(800, 600);
  flower = loadImage("k.png");
}

void draw() {
  background(0);
  if (show) image(flower, 0, 0);
}
void mousePressed() {
  show = !show;
  flower.resize(0, 500); 
  //image(flower, 0, 0);
}

```

---

<div class="post-metadata">

**Author:** ![Kalarila](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@Kalarila](https://discourse.processing.org/u/Kalarila)\
**Post date:** [October 30, 2022, 10:57am UTC](https://discourse.processing.org/t/can-you-resize-an-image-and-only-show-the-new-image/39472/5 "2022-10-30T10:57:33Z")

</div>

thx for the help, it’s working now :).

---

<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 30, 2022, 11:30am UTC](https://discourse.processing.org/t/can-you-resize-an-image-and-only-show-the-new-image/39472/6 "2022-10-30T11:30:36Z")

</div>

Hello @Kalarila,

Keep in mind that there are may resources (tutorials, references, examples, etc.) 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…

It is worthwhile to peruse these and get familiar with them.  
It gets easier to navigate and find what you are looking for with experience.  
I find them to be an invaluable resource!

For example:  
[https://processing.org/reference/PImage.html](https://processing.org/reference/PImage.html)  
Which leads to:  
[https://processing.org/reference/PImage\_resize\_.html](https://processing.org/reference/PImage_resize_.html)

Have fun coding!

`:)`
