# Image() function with 4 points

**URL:** <https://discourse.processing.org/t/image-function-with-4-points/35182>\
**Category:** Beginners\
**Created:** [February 15, 2022, 4:52pm UTC](https://discourse.processing.org/t/image-function-with-4-points/35182 "2022-02-15T16:52:04Z")\
**Posts on this page:** 1\
**Showing post:** 21

<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:** [February 19, 2022, 2:36pm UTC](https://discourse.processing.org/t/image-function-with-4-points/35182/21 "2022-02-19T14:36:51Z")

</div>

@chrisir,

Can you provide some context for this statement:

> [@Chrisir](#):
>
> using image() with 5 parameters is always slower than  
> using it with 3 parameters, so you want to use resize command

I am seeing the opposite in the context of my example below.

_image() with 5 parameters_ is _faster_ than _resize()_ in this example:

```auto
PImage img1, img2;
int t1, t2;
boolean toggle;

void setup() 
  {
  size(800, 800, P2D);
  img1 = loadImage("https://upload.wikimedia.org/wikipedia/commons/thumb/2/26/A_beautiful_view%2C_Kel%2C_Kashmir.jpg/480px-A_beautiful_view%2C_Kel%2C_Kashmir.jpg");
  println(img1.width, img1.height);
  mouseX = 1; mouseY = 1;
  }

void draw() 
  {
  background(0); 
  
  img2 = img1.copy();
  
  // image
  if (toggle)
    {
    t1 = millis();
    image(img2, 0, 0, mouseX, mouseY);
    t2 = millis();
    println("image", t2-t1);
    }
  // resize
  else
    {
    t1 = millis();
    img2.resize(mouseX, mouseY);
    image(img2, 0, 0);
    t2 = millis();
    println("resize", t2-t1);
    }
  }
  
void mouseClicked()
  {
  toggle = !toggle;
  }

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/57c170b04c7e0c5e974f6bd5dbe92b002ee8af48.jpeg)

Related topic:  
_[Faster PImage Resizing](https://discourse.processing.org/t/faster-pimage-resizing/33593)_

`:)`

---

_[View the full topic](https://discourse.processing.org/t/image-function-with-4-points/35182)._
