# Custom mouse cursor

**URL:** <https://discourse.processing.org/t/custom-mouse-cursor/21549>\
**Category:** Coding Questions\
**Created:** [June 4, 2020, 7:03am UTC](https://discourse.processing.org/t/custom-mouse-cursor/21549 "2020-06-04T07:03:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgood7123](https://avatars.discourse-cdn.com/v4/letter/m/54ee81/32.png) [@mgood7123](https://discourse.processing.org/u/mgood7123)\
**Post date:** [June 4, 2020, 7:03am UTC](https://discourse.processing.org/t/custom-mouse-cursor/21549/1 "2020-06-04T07:03:41Z")

</div>

how can i customize the cursor that is displayed inside Processing 3, for example, make it appear as a custom png image instead of the OS’s cursor image

---

<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:** [June 4, 2020, 7:06am UTC](https://discourse.processing.org/t/custom-mouse-cursor/21549/2 "2020-06-04T07:06:50Z")

</div>

You can have cross hand or arrow

See reference

But you can display an image at mouse position

You can hide mouse cursor with noCursor()

---

<div class="post-metadata">

**Author:** ![mgood7123](https://avatars.discourse-cdn.com/v4/letter/m/54ee81/32.png) [@mgood7123](https://discourse.processing.org/u/mgood7123)\
**Post date:** [June 4, 2020, 7:08am UTC](https://discourse.processing.org/t/custom-mouse-cursor/21549/3 "2020-06-04T07:08:42Z")

</div>

hmm so one technique may be to hide the mouse cursor, then load an image and have it follow the mouseX and mouseY?

---

<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:** [June 4, 2020, 7:20am UTC](https://discourse.processing.org/t/custom-mouse-cursor/21549/4 "2020-06-04T07:20:52Z")

</div>

That’s right

Use imageMode CENTER

It’s not exactly the same but I don’t know how to make a customized mouse arrow

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 5, 2020, 2:44am UTC](https://discourse.processing.org/t/custom-mouse-cursor/21549/5 "2020-06-05T02:44:37Z")

</div>

> [@mgood7123](#):
>
> the cursor that is displayed inside Processing 3, for example, make it appear as a custom png image

User `cursor(myImg)`

> cursor(img)

It is described on the cursor reference page.

> **[cursor() / Reference](https://processing.org/reference/cursor_.html)**
>
> Sets the cursor to a predefined symbol or an image, or makes it visible if already hidden. If you are trying to set an image as the cursor, the recommended size is 16x16 or 32x32 pixels. The values fo…

For example, here is a sketch with a tiny Processing logo as a cursor.

```auto
/**
 * Custom mouse cursor basic example
 * 2020-06-04 Processing 3.5.4
 * https://discourse.processing.org/t/custom-mouse-cursor/21549
 */
void setup(){
  size(400, 400);
  PImage img = loadImage("https://upload.wikimedia.org/wikipedia/commons/thumb/2/2e/Processing_3_logo.png/600px-Processing_3_logo.png");
  img.resize(64, 64);
  cursor(img);
}

void draw(){}

```

---

<div class="post-metadata">

**Author:** ![mgood7123](https://avatars.discourse-cdn.com/v4/letter/m/54ee81/32.png) [@mgood7123](https://discourse.processing.org/u/mgood7123)\
**Post date:** [June 5, 2020, 2:59am UTC](https://discourse.processing.org/t/custom-mouse-cursor/21549/6 "2020-06-05T02:59:37Z")

</div>

and umm how would i reset the cursor image? if possible

like would i need to set a default cursor such as `ARROW` then change and reset as desired?

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 5, 2020, 4:48am UTC](https://discourse.processing.org/t/custom-mouse-cursor/21549/7 "2020-06-05T04:48:16Z")

</div>

Did you try using any of the `cursor()` commands on the reference page? What happened when you tried?
