# Exporting and pictures issue

**URL:** <https://discourse.processing.org/t/exporting-and-pictures-issue/12931>\
**Category:** Coding Questions\
**Created:** [July 23, 2019, 9:29pm UTC](https://discourse.processing.org/t/exporting-and-pictures-issue/12931 "2019-07-23T21:29:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gillyboat4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gillyboat4/32/5905_2.png) [@gillyboat4](https://discourse.processing.org/u/gillyboat4)\
**Post date:** [July 23, 2019, 9:29pm UTC](https://discourse.processing.org/t/exporting-and-pictures-issue/12931/1 "2019-07-23T21:29:15Z")

</div>

In my experience, whenever I try to export a sketch containing a PImage, loadImage and image(); functions, the sketch will fail to load those parts.  
PImage I = loadImage(“hi.png”);  
image(I,0,0,100,100);  
this code when exported to an application will not be able to run correctly on my computer  
Anyone know how to get around this, or why it happens?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [July 24, 2019, 1:07am UTC](https://discourse.processing.org/t/exporting-and-pictures-issue/12931/2 "2019-07-24T01:07:57Z")

</div>

-a- please format your code so it is copy/usable

```auto
PImage I = loadImage("hi.png");
image(I,0,0,100,100);

```

[https://processing.org/reference/loadImage\_.html](https://processing.org/reference/loadImage_.html)

ok, your code works here ( processing 3.5.3 / win7 / 64bit )  
if the file with name hi.png

- is in a subfolder /data
- OR just with the sketch.

if not get a error

```auto
The file "hi.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
NullPointerException
Could not run the sketch (Target VM failed to initialize).
Make sure that you haven't set the maximum available memory too high.
For more information, read revisions.txt and Help ? Troubleshooting.

```

* * *

note: even that processing version uses that smart trick  
look also in /data/ for most of the file load commands,  
that does not work for file store and not for several libraries…

so i ask you to ignore that “trick” and use

```auto
String infile = "data/hi.png", outfile = "<drive>\<path>\filename"; 

```

* * *

variable naming:  
pls do not use “I”, better “img”  
-a- variables are supposed to start with small letters  
( classes with big letter )  
-b- “i” does not say much but is mostly used for a integer ( like in a for loop )  
-c- but also never call it “image” as that is a reserved function.

---

<div class="post-metadata">

**Author:** ![gillyboat4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gillyboat4/32/5905_2.png) [@gillyboat4](https://discourse.processing.org/u/gillyboat4)\
**Post date:** [July 24, 2019, 1:01pm UTC](https://discourse.processing.org/t/exporting-and-pictures-issue/12931/3 "2019-07-24T13:01:54Z")

</div>

sorry about the formatting and variables, I’m new to this. The issue seemed to be that when I was exporting the sketch to an application (running in processing worked fine) the pictures weren’t put with the application so it didn’t load.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [July 24, 2019, 3:03pm UTC](https://discourse.processing.org/t/exporting-and-pictures-issue/12931/4 "2019-07-24T15:03:56Z")

</div>

sure i tested here the export  
the /data/ folder with the picture was inside the win64 app folder, under the exe.

---

<div class="post-metadata">

**Author:** ![gillyboat4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gillyboat4/32/5905_2.png) [@gillyboat4](https://discourse.processing.org/u/gillyboat4)\
**Post date:** [July 24, 2019, 9:35pm UTC](https://discourse.processing.org/t/exporting-and-pictures-issue/12931/5 "2019-07-24T21:35:45Z")

</div>

yeah, for some reason that wan’t happening with me

---

<div class="post-metadata">

**Author:** ![gillyboat4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gillyboat4/32/5905_2.png) [@gillyboat4](https://discourse.processing.org/u/gillyboat4)\
**Post date:** [July 24, 2019, 9:36pm UTC](https://discourse.processing.org/t/exporting-and-pictures-issue/12931/6 "2019-07-24T21:36:21Z")

</div>

there was no data folder, idk what was up with that

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [July 25, 2019, 12:59am UTC](https://discourse.processing.org/t/exporting-and-pictures-issue/12931/7 "2019-07-25T00:59:55Z")

</div>

-a- environment

> [@kll](#):
>
> ok, your code works here ( processing 3.5.3 / win7 / 64bit )

can you think of any reason why i posted this info?  
so please can you tell us little bit about your setup

-b- please make it clean and document it here:  
-b1- make a data subfolder and put the picture file in  
-b2- make the variable

```auto
String infile = "data/hi.png"

```

and use it for the loadImage  
-b3- export ( with the incl JAVA option )  
-b4- show us the export directory tree
