im quite new to python so forgive my stupidity. ive downloaded numpy and here are a few things i understand regarding images and numpy

1.images are made up of pixels that have coordinates, a 2d array i believe
2.numpy has the ability to handle arrays and split them

what i want to do is this: given a 300x300 image i would like to split it into smaller 5x5 arrays.

ive tried numpy.split and have seen it work for 1 dimensional arrays. the problem is how do i make it work for 2d arrays

im=Image.open ("trial.jpg")              

im.thumbnail((300,300) , Image.ANTIALIAS)   
im.save("im.jpg")

openres = Image.open ("im.jpg")
loadres = openres.load()

b = numpy.split(loadres,100)

when i run the code above i get a lot of errors. anyone care to help?

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.