# Can I load an image of a buffer and add it to a sprite

**URL:** <https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018>\
**Category:** Coding Questions\
**Created:** [June 20, 2020, 6:37am UTC](https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018 "2020-06-20T06:37:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ARNAV\_A\_GUPTA](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/arnav_a_gupta/32/9660_2.png) [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Post date:** [June 20, 2020, 6:37am UTC](https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018/1 "2020-06-20T06:37:20Z")

</div>

I don’t know how to do it, the simple way is not working, is there any way to so it?? I am getting error like pathOfIndex is not defined on my loadImage line. Plz help me fast…

---

<div class="post-metadata">

**Author:** ![SomeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/someone/32/8639_2.png) [@SomeOne](https://discourse.processing.org/u/SomeOne)\
**Post date:** [June 20, 2020, 3:43pm UTC](https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018/2 "2020-06-20T15:43:21Z")

</div>

It’s a bit hard to say what’s wrong without a code example. Out of the blue, my guess is that you are using wrong character to define the path. Windows uses ‘’-character and other systems uses ‘/’-character. Second option is that you down refer the path correctly against the working directory of Processing

---

<div class="post-metadata">

**Author:** ![ARNAV\_A\_GUPTA](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/arnav_a_gupta/32/9660_2.png) [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Post date:** [June 20, 2020, 7:19pm UTC](https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018/3 "2020-06-20T19:19:56Z")

</div>

nope, found another way. and sharing the massive 500 liner code is pretty much impractical. in my code, the conditional programming is at its peak, you wouldn’t understand without seeing the whole code… @SomeOne
