This might be a silly question, but...
I have several thousand images that I would like to load into Python and then convert into numpy arrays. Obviously this goes a
Oh I just realized there might be a far, far simpler way than doing what I wrote above regarding the BMP files.
If you are generating the image files anyway, and you always know which portion you want to read, simply save that portion out as another image file while you're generating it:
import numpy as np
import matplotlib.pyplot as plt
import Image
#Generate sample images
num_images = 5
for i in range(0,num_images):
Z = np.random.rand(2000, 2000)
plt.imsave('%03i.png'%i, Z)
snipZ = Z[200:300, 200:300]
plt.imsave('%03i.snip.png'%i, snipZ)
#load the images
for i in range(0,num_images):
im = Image.open('%03i.snip.png'%i)
#convert them to numpy arrays
data = np.array(im)