[Image-SIG] Hi

Nick De Lorenzo nick.delorenzo at gmail.com
Tue Aug 22 09:02:45 CEST 2006

On 8/19/06, Paul Prescod <paul.prescod at xmetal.com> wrote:
> I just finished a PIL program and I feel like there may have been more
> efficient ways to do things I did "by hand" with the raw data. Can
> someone enlighten me?
> 1. I wanted to take 24 bit data, count the colours and make an 8-bit BMP
> if there are fewer than 256 colours. My brute force solution required me
> to build the palette by hand from the data and rewrite the data one
> pixel at a time. (a simple '.convert("P")' seems to use an arbitrary
> palette or something???)
> 2. I wanted to pad a bitmap by adding some space to the right and
> bottom. I did this by creating a new one and pasting the old one into
> it.
> 3. I wanted to convert every occurrence of one colour to another. I
> walked each pixel.
> I also could not figure out how to get to a 4-bit BMP. I inferred from
> the documentation that this just isn't possible with out of box PIL.
> Overall: PIL really rocks.
>  Paul Prescod
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig

More information about the Image-SIG mailing list