# loadImage does not Load Image from data folder

**URL:** https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951
**Category:** Beginners
**Created:** [July 31, 2020, 8:36am UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951 "2020-07-31T08:36:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![JohnnyWhy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/johnnywhy/32/10137_2.png) [@JohnnyWhy](https://discourse.processing.org/u/JohnnyWhy)
#### Post date: [July 31, 2020, 8:36am UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951/1 "2020-07-31T08:36:07Z")

</div>

2020-07-31T07:00:00Z  
I am using the loadImage example, and definately have the image saved in the data folder of the active sketch.  
Except for the web URL example below, I get the error message: _“The file “moire.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable. NullPointerException”_

I suspect my path is wrong somehow, I have tried many more options than shown here.  
I read that “the image file must be in the data folder of the current sketch.”  
I quadruple checked & the image file is there in the data folder, and readable. Tried other file formats too.  
Thanks in advance!  
John

```auto
PImage img;
void setup() {
  
    dataPath("data/moire.jpg");
    println(dataPath(""));
    
//img = loadImage("data/moire.jpg"); // does not work
// img = loadImage("moire.jpg"); // does not work
// img = loadImage("C:\Users\john\Documents\Processing\moire3\data\moire.jpg"); // does not work
// img = loadImage(" http://www.cosmation.com/images/cosmationpostcard2lowres.jpg"); // this works
}
void draw() {
  image(img, 0, 0);
}

```

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [July 31, 2020, 1:52pm UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951/2 "2020-07-31T13:52:30Z")

</div>

LoadImage or loadImage?

---

<div class="post-metadata">

### Author: ![Spaceman1](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/spaceman1/32/9970_2.png) [@Spaceman1](https://discourse.processing.org/u/Spaceman1)
#### Post date: [July 31, 2020, 5:13pm UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951/3 "2020-07-31T17:13:06Z")

</div>

It should work even without specifying the path.

Your 3rd option (where you wrote out the full path) doesn’t work because you used backslash instead of a forward slash. backslash signals an escape sequence.

I don’t know how your files are set up but this probably means something is named incorrectly. Check that:

1. The data folder is named correctly
2. The file is named correctly (This is case sensitive)
3. You have the correct file extension (.png, .jpg etc)

I know that you may have already done all this (and if that’s the case I’m probably just frustrating you 😌) . If there are no other visible problems I would just try it with a different picture. Try to isolate where exactly is the problem.

---

<div class="post-metadata">

### Author: ![JohnnyWhy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/johnnywhy/32/10137_2.png) [@JohnnyWhy](https://discourse.processing.org/u/JohnnyWhy)
#### Post date: [July 31, 2020, 9:07pm UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951/4 "2020-07-31T21:07:30Z")

</div>

Thanks for your help.  
Things I’ve tried before asking for help: different images, different file formats, spelling & case options such as: PNG,JPG, TGA, . jpg, JPG, JPEG.  
Recreated sketch, saved to new folder. Made data folder and added image manually.  
Recreated sketch, saved to new folder. Dragged image to sketch. Processing made a data folder and added image to it.  
Recreated sketch, saved to new folder. Used “add file” from sketch menu options. Chose image and saw that Processing made a data folder and added image to it.  
I’ve specified the path, and not specified the path.  
Only a lower case l in loadImage works. Not sure why theres a capital L in my code I shared.

saved and ran, same results. I agree something is off.  
Will start over with yet another new / different image, and sketch.  
Thanks for reviewing. Very helpful!  
John

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [July 31, 2020, 10:09pm UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951/5 "2020-07-31T22:09:24Z")

</div>

> [@JohnnyWhy](#):
>
> Not sure why theres a capital L in my code I shared.
> 
> saved and ran, same results.

What editor are you using, and which platform?

---

<div class="post-metadata">

### Author: ![JohnnyWhy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/johnnywhy/32/10137_2.png) [@JohnnyWhy](https://discourse.processing.org/u/JohnnyWhy)
#### Post date: [August 1, 2020, 3:17am UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951/6 "2020-08-01T03:17:46Z")

</div>

Using Windows 10, the stock PGE editor. Java. Still wrapping my head around the P5.js

---

<div class="post-metadata">

### Author: ![JohnnyWhy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/johnnywhy/32/10137_2.png) [@JohnnyWhy](https://discourse.processing.org/u/JohnnyWhy)
#### Post date: [August 1, 2020, 5:30am UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951/7 "2020-08-01T05:30:23Z")

</div>

**Issue resolved:** Apparently it was windows (and my) foolishness.  
I tried again tonight with new images and noticed none of my images had the file type extension showing.  
I turned on “Show file name extensions”, and saw that my failing to load files had names like “moire.jpg.jpg”.  
Yes, I had added the extension in myself in my hours of thrashing around. I am usually on a mac, and forgot that I did not have that display option enabled on this windows box. Thought that adding the extension would help, not knowing the extension was there, but just not being shown.  
I removed the double extension and _like magic,_ files were found, no errors.  
Thanks for the advice and help.  
Back to reading the manual!  
Window setting: “_Enable file name extensions_” was part of the solution, showing I had added 2 extensions in my troubleshooting.  
Johnny Why

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [August 1, 2020, 12:46pm UTC](https://discourse.processing.org/t/loadimage-does-not-load-image-from-data-folder/22951/8 "2020-08-01T12:46:51Z")

</div>

> [@JohnnyWhy](#):
>
> I turned on “Show file name extensions”,

1st thing I do when I’m finished installing Windows is to check that option. ✔

So many victims fell to files such as “moire.jpg.exe” when they just see “moire.jpg”. 🙈
