yes, It should be (2^n)+1
ex:
65, 129, 257, 513, 1025, 2049, 4097.
But i dont recommend bigger values than 1025 because it will eat much memory.
An 1025x1025 image will be rezized in the ram memory as 2048x2048
and 2049x2049 as 4096x4096, guess so much memory can eat an image of that size... a lot!