PIL Problem: New image is all black on Unix?

Thomas & Jennifer Thompson tmt1630 at cs.rit.edu
Sun Feb 20 22:10:02 EST 2000


Thanks for the reply.

You're right...a type "1" image is monotone, but the pixel representation is
8-bits thus: 0x00 = black and 0xFF = white.  Nonetheless, I tried your
suggestion and got the same results: all BLACK.

Any other thoughts?

Kevin Cazabon wrote:

> A type "1" image is a monotone black/white image.  Instead of using 0xFF and
> 0x00 as colors, try using 0 and 1 (on and off).
>
> Kevin Cazabon.
>
> "Thomas & Jennifer Thompson" <tmt1630 at cs.rit.edu> wrote in message
> news:38B02B50.482854B7 at cs.rit.edu...
> > I'm running Python v1.5.2 on Solaris 5.7 with PIL v1.0.  When I create a
> >
> > new image of type "1' and size xy with either white or black pixels,
> > the image comes out black in both cases. So:
> >
> > >>> import Image
> > >>> raw=Image.new("1", (20,20), 0xFF)
> >
> > returns a black image which I expect to be white.
> >
> > >>> import Image
> > >>> raw=Image.new("1", (20,20), 0x00)
> >
> > returns a black image which I do expect.
> >
> > Further, if I try to set a pixel to white using
> > ImageDraw.setink(color) and ImageDraw.point(xy),
> > it still comes out black.
> >
> > These commands work fine on my Win95 system (Python
> > v1.5.1, PIL v1.0b1). Is this a known bug with PIL and Solaris
> > and will using the latest version of PIL for Solaris fix this?
> > Or did I miss something somewhere?
> >
> > Any help would be greatly appreciated!
> >
> > Tom Thompson
> >




More information about the Python-list mailing list