<p>I want to, from JavaScript, access as a variable the file that is loaded as an image in an img tag. </p>

<h2>I don't want to access its name, but the actual data.</h2>

<p>The reason for this is that I want to be able to copy it to and from variables so that I can , among other things, change the image without reloading it.</p>

<p>Can this be done? If so, how?</p>

<p>Note: I'm slightly more interested in <em>reading</em> the data than writing it.</p>

Try this:
```
```
img = new Image(); 
img.src = "imagefile.jpg";
```
```