[Image-SIG] Re: BitmapImage instanciation of an xbm

Fredrik Lundh fredrik at pythonware.com
Tue Nov 18 17:04:29 EST 2003


Nathan Johnson wrote:

> When I try to open an xbm image either from file or embedded in
> python code(as shown below) the PIL says it can't identify the
> image file.  It seems like the BitmapImage class should be able
> to recognize the standard xbm format. The reason I'm using the
> PIL to open the xbm is because I need to resize the image.  If
> anybody knows a better way of opening a .xbm file and being able
> to resize it, I'm open to suggestions.

a quick look at the sources indicate that the PIL XBM decoder
is a bit pickier than it needs to be; the first "#define" must be
on the first line of the file.

adding a backslash to the end of the BITMAP line should solve
your problem:

    BITMAP = """\
    #define basic_width 32
    ...

</F>






More information about the Image-SIG mailing list