PIL FITs image decoder

Fredrik Lundh fredrik at pythonware.com
Tue Nov 22 12:56:04 EST 2005


"jbrewer" wrote:

> I'm trying to read in a FITs image file for my research, and I decided
> that writing a file decoder for the Python imaging library would be the
> easiest way to accomplish this for my needs.  FITs is a raw data format
> used in astronomy.
>
> Anyway, I followed the example in the PIL documentation online, and I
> also had a look at the FITs image stub file included with PIL 1.1.5.  I
> cooked up something that should work (or nearly work), but I keep
> running into either one of two errors (below).  The crux of the problem
> appears to be that my plugin isn't being registered properly and isn't
> being read at runtime when I call Image.open().
>
> 1.)  The library loads the FitsStubImagePlugin.py file from the
> site-packages directory (instead of my plugin) and then gives the
> following error:

unfortunately, the stub loaders (which were introduced in 1.1.5) may over-
ride more specific plugins.  this will be fixed in 1.1.6.

I don't see any obvious problems with your file, except that you should in-
herit from ImageFile, not StubImageFile:

    class FitsImageFile(ImageFile.StubImageFile):

should be

    class FitsImageFile(ImageFile.ImageFile):

but I assume you've already tried that.

if you can you mail me (or point me to) a sample file, I can take a look.

</F> 






More information about the Python-list mailing list