Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87905

Re: Pillow bug?

References <80cb2142-1830-4216-9e9b-76b4f720071c@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2015-03-24 14:14 -0600
Subject Re: Pillow bug?
Newsgroups comp.lang.python
Message-ID <mailman.116.1427228107.10327.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Mar 24, 2015 at 1:52 PM,  <kai.peters@gmail.com> wrote:
> Judging from the message archive, the image-sig list is (just about) dead?
>
> Disclaimer: Am a newbie - so anything is possible
>
>
> using 'RGB' works fine
>
>     img = Image.new('RGB', (inktile[0], inktile[1]), bgcolor)
>
> using '1' or 'L' does not (see trace below)
>
>     img = Image.new('L', (inktile[0], inktile[1]), bgcolor)
>
>
> I change nothing else but the first parameter. If I switch the 'L' back to 'RGB' it works again.
>
>
>     img      = Image.new('L', (inktile[0], inktile[1]), bgcolor)
>   File "C:\Python27\lib\site-packages\PIL\Image.py", line 2015, in new
>     return Image()._new(core.fill(mode, size, color))
> TypeError: an integer is required
>
> The docs say that '1' and 'L' are supported - something broken? Something I do not understand?

What is the value of bgcolor that you're passing in? Per the docs: "If
given, this should be a single integer or floating point value for
single-band modes, and a tuple for multi-band modes (one value per
band)." So if you're changing from a multi-band mode to a single-band
mode, you would need to change the color argument as well.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Pillow bug? kai.peters@gmail.com - 2015-03-24 12:52 -0700
  Re: Pillow bug? Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-24 14:14 -0600
    Re: Pillow bug? kai.peters@gmail.com - 2015-03-24 13:24 -0700
  Re: Pillow bug? Terry Reedy <tjreedy@udel.edu> - 2015-03-24 16:17 -0400

csiph-web