[IMAGE-SIG] [Q] PIL problems: install, palette

Fredrik Lundh fredrik@pythonware.com
Wed, 3 Dec 1997 20:44:19 +0100

Harald Singer writes:
>we just tried to install PIL on Linux, HP-UX, OSF1 and SunOS and we
>ran into several interesting (boring?) problems. Our final goal is to
>display some nice colourful spectrograms (like in matlab).
>1] basic install problems
>1a] python: can't resolve symbol 'ImagingCrack'
>    solution: commented out _crack in _imagingmodule.c
>1b] the configure script is seriously broken when trying to use libz =
>    and libjpeg that are not in /usr/local/lib and /usr/local/include
>    solution: patched the Makefile by hand
>1c] the makefiles are not setup for dealing with libjpeg.so and libz.so
>    solution: patched Setup.in
>              JPEGLIB =3D -L$(MYSHLIB) -ljpeg

1a is fixed in the next release; I'm not sure how to handle 1b (I've
advertised for autoconf gurus before, with no result). I'll do some-
thing about 1c in the next release.

>2] on HP-UX9.05, the 'make test' gives completely different results =
>compiling with gcc and cc. Lena appears but is heavily discoloured when
>using gcc. With cc, it looks more like a 'photoshop' job.
>I have the suspicion that the cc version is correct. How can I find =

This might be due to a buglet in Paste.c; check the defines at the
top of the file, and make sure they look like:

#define MULDIV255(a, b, tmp)\
     (tmp =3D (int) (a) * (b) + 128, (((tmp >> 8) + tmp) >> 8))

#define BLEND(mask, in1, in2, tmp)\
     MULDIV255(in1, 255 - mask, tmp) + MULDIV255(in2, mask, tmp)

#define COMPOSE(mask, in1, in2, tmp)\
     MULDIV255(in1, 255 - mask, tmp) + in2

>3] some examples simply don't run.
>AttributeError: palette

fixed in the current codebase; will make it into the next release.

>[4] I am reading a .jpg and trying to save as .gif
>and get this error:
> IOError: cannot save mode RGB as GIF
>What am I doing wrong?

0.3a1 and earlier cannot convert from RGB (24-bit) to palette images :-(
Will be fixed in 0.3 final (and is also the reason there's no 0.3 final =
just haven't had the time to do something about it).

>[5] in Lib/ImageTk.py
>the line=20
> mode =3D image.palette.mode
>fails for mode =3D=3D "P".

IIRC, this has also been fixed in the current codebase.

>[6] will this still be freeware? I find it slightly disconcerting that
>the binary version for Windows is more advanced than the source

That's mainly because I haven't had time to move the stuff from
the development machine (at home) to a Unix box (at work), and
wrap it up in a nice tarball...

And yes, PIL will be free also in the future, even if the copyright
may be transferred to Secret Labs AB in the next release.

But we'll probably release a few commercial add-ons during the
next year; there are lots of cool things being worked on over at
the labs.

Cheers /F

IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org