Added seek support to make writing jp2 files work.  Also added support for directly using an fd rather than relying on the Python loop, if we have a real fd.