Re: HowToShowImages

Steve Lamont (
Wed, 26 Feb 97 06:32:27 PST

To subscribers of the xforms list from (Steve Lamont) :

> Hi! As a new user I would like to know the best way to insert Gif and
> Jpgs in my forms and if it can overlay or not text that may be under (That
> would be helpfull if it can do both easily).

It depends. First you need some way to decode JPEG or GIF. XForms
won't help you there -- you'll need some other tool set. Check the
sources for xv, ImageMagick, or one of the other freely available tool

Once you've got an array of bytes you'll need to stuff it into a
Pixmap and feed it to either the Pixmap object or to a Canvas object
if you're planing on doing something more elaborate.

If you have a TrueColor display then it's easy -- just create
an XImage, write the data into the XImage, then create a Pixmap from
the XImage (refer to your favorite Xlib manuals for details).

If you have a PseudoColor display, it's a little more complicated.
You still go through the XImage to Pixmap bit but you've first got to
color quantize the image down to (usually) 8 bits and map that lookup
table into your default Colormap (you don't want color flashing, do
you?). There is a nice octree quantization algorithm in one of the
Graphics Gems books. (I've implemented it as a library and as soon as
I'm done with The Project That Will Not End I'll get it into some sort
of distributable shape and release it).

> --
> /------\ /-------\ mail:
> / /-----/ / / /
> / / / /______/ __ ___
> / /==> _ / / \ / / / / / _/ student
> / / / | |/\ /~ | / / / / / / / /-/ at
> |_/ \_| | | \_ | |_/________/ |__/ |__/ / | EPITA

Uh... this isn't directed only at this poster : can we *please* trim
the .signatures? Some of these huge .signatures are getting a bit
absurd. `Creativity' is a wonderful thing but when the .signature is
longer than the content... well, really.

Yeah, I know. Picky picky picky.

Staff Curmudgeon
To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: