Reading a file to make a texture

I used Photoshop to convert a jpeg photo into a targa bump map file. I want to read up this file from the directory containing the JavaScript code and do a little bit of processing to create a bump map texture (remove the 18-byte header, flip BGR -> RGB). But all of the examples I’ve found for loading texture information from files use gifs, which apparently are acceptable with no further processing. Can someone give me a hint on how to get a binary file (such as a targa file) into JavaScript arrays, which I can then pass to a texture?

Alternatively, maybe there’s an output from Photoshop and some JavaScript syntax to get to a bump map texture without JavaScript manipulation of the data?

Ah. I finally discovered that png and jpg files are also accepted, not just gif. Dunno where there is any documentation on the acceptable file formats (by experiment, targa files are not accepted).