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


Groups > comp.lang.python > #87901 > unrolled thread

Pillow bug?

Started bykai.peters@gmail.com
First post2015-03-24 12:52 -0700
Last post2015-03-24 16:17 -0400
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  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

#87901 — Pillow bug?

Fromkai.peters@gmail.com
Date2015-03-24 12:52 -0700
SubjectPillow bug?
Message-ID<80cb2142-1830-4216-9e9b-76b4f720071c@googlegroups.com>
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?

Thanks for any pointers,

Kai

[toc] | [next] | [standalone]


#87905

FromIan Kelly <ian.g.kelly@gmail.com>
Date2015-03-24 14:14 -0600
Message-ID<mailman.116.1427228107.10327.python-list@python.org>
In reply to#87901
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.

[toc] | [prev] | [next] | [standalone]


#87907

Fromkai.peters@gmail.com
Date2015-03-24 13:24 -0700
Message-ID<b009b5da-cd42-4ba3-91f1-209dd8d5fe35@googlegroups.com>
In reply to#87905
On Tuesday, 24 March 2015 13:15:42 UTC-7, Ian  wrote:
> On Tue, Mar 24, 2015 at 1:52 PM,  Kai 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.

Good catch - that was it.

Thanks much!

[toc] | [prev] | [next] | [standalone]


#87906

FromTerry Reedy <tjreedy@udel.edu>
Date2015-03-24 16:17 -0400
Message-ID<mailman.117.1427228330.10327.python-list@python.org>
In reply to#87901
On 3/24/2015 3:52 PM, kai.peters@gmail.com wrote:
> Judging from the message archive, the image-sig list is (just about) dead?

PIL and/or pillow should have their own lists.

-- 
Terry Jan Reedy

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web