This bug was caused by the fact that ctypes silently converts returned
c_void_p instances into python int values, even if the restype of a function
is c_void_p. Then, without explicit argtypes (which this module doesn't use,
out of laziness on my part), python ints passed to functions are treated as
32-bit ints.
Solution: explicitly wrap returned pointers as c_void_p, so that they'll get
treated right when passed back to C. No more segfaults!
I also reverted the _wrap_bitmap_bits_in_array code to what I wrote, as I
can vouch for that on 64-bit, whereas the other version had a "still crashes"
note...
Previously, the plugin perfomed a copy of the bitmap's pixel memory
instead of mapping into a ndarray. This fixes it. Also, it saved images
rotated by 90 degrees as it didn't convert to freeimage's internal
format.
Copying less also makes imread visibly faster.