Thanks to @CraigDJones's comment on the Planes addon, and lots of digging around, I've narrowed down how to custom-import images.
First, as with any extension importing anything, it's necessary to write an Operator class for handling the file windows. As I am extremely new, this is something I'm still in the process of figuring out. However, operators do seem to be pretty general, as they do a large number of things. For starters, Here's Blender's Operators - bpy.ops reference.
For importing images, I discovered it's possible to instantiate a new image via the
bpy.data.images.new(name,width,height) method. Then from there, pixels can be easily accessed and changed via the
image_object.pixels array, which indexes the pixels data from left to right, then bottom to top as clamp (0.0 to 1.0) values. Each pixel has four values in this array: R, G, B, and A. Here's a simple example:
image_object = bpy.data.images.new("New image",1024,1024)
image_object.pixels[0:3] = (0.5,0.5,0.5) # R,G,B - changes bottom left pixel
# makes entire image half-transparent red
for i in range(0,len(image_object.pixels), 4):
image_object.pixels[i:i+4] = (1,0,0,0.5)
A note of caution: So after a little effort, I was able to write a script for importing the image type I'm working with. For those doing the same, though, pixel operations on the image pixel data itself, e.g.
image_object.pixels[...] = ..., are very slow. My script took about 20mins to import an image because it was directly copying each pixel to the
image_object's pixel data. But after I made it copy to a separate buffer, and then dump everything over, e.g.
image_object.pixels[0:] = another_buffer it went lightning fast.