support arbitrary sized images (does not need to be of a certain multiplicative size)
blocksize has to be at least 1 so it works
removed debug output & some comments