Developing Imaging Applications with XIElib
Author: Syd Logan
Publisher: Prentice Hall
Price: $54 US
Reviewer: Michael J. Hammel
Computer graphics have come a long way for Linux users in the past two years. Applications of all kinds have started to show up in many places, coming from both the Open Source community as well as commercial vendors. One reason for this recent growth is the flexibility and extensibility of the native windowing system: the X Window System, also known as X11. Although end users are the eventual benefactors of this flexibility, it is the development side of Linux that will be most interested in one of X11's least-known extensions—the X Image Extension.
The X Image Extension, as the name implies, is not part of the core X11 distribution, although any system using X11 Release 6 (aka X11R6) should have this extension included. The X Image Extension, more commonly known as XIE, provides a mechanism for graphic image management in the client/server environment of X11. Image decompression, for example, can be handled on the server side (the display side) instead of overloading clients with this common and resource-consuming task.
Some time back, the author of Developing Imaging Applications with XIElib, Syd Logan, contacted me about this extension and recommended the GIMP developers take a look at it. At the time, I was modestly involved in GIMP development, back in the very early days when the GIMP was still a Motif application. XIE never really seemed to catch on in the developer community for the GIMP. Perhaps it was simply because no text was available from which to learn the API (the applications programming interface or the interface into XIE's software library). It may also have been due to the fact that not all developers were on Linux at the time and not all UNIX vendors had migrated to X11R6, a situation that continues to this day.
Despite the GIMP not using XIE, I've still been interested in what XIE is all about. What can it be used for? How difficult is adding it to an existing application? Does it help solve some of the more mundane problems in computer graphics, or is it more focused on specific types of problems?
Syd's book is well-organized and provides answers to most of these questions. The text is thick—well over 600 pages—with chapters ranging from introductions to existing image handling methods in Xlib to the nuts and bolts of XIE's API and its underlying data structures. The chapters flow from an overview of the XIE architecture into high-level concepts such as “photoflo elements” and image file formats to more detailed descriptions of using “process elements” to do format conversions and the use of “techniques”, the algorithms used by the server side for image processing.
Even with my self-taught experience in graphics terminology, I discovered XIE has a whole new set of terms to learn. A fairly complete glossary of these terms is included at the end of the text, but you'll find Syd's definitions within the text to be a better source of information. He does a good job explaining new terms quickly and fitting them into the larger picture that is XIE.
Accompanying the text is a CD with a modest bit of sample code from the text. The README on the CD is quite extensive and should be read before trying to build or run any of the software on the CD. Some of the files on the CD do not have read permissions for anyone but the file owner, so you'll have to copy the files from the CD as the root user and then do a chown/chmod sequence to get them installed properly.
The libtiff and jpeg libraries, required to build the XIE samples, don't build easily from the CD. I downloaded the latest libtiff source from the FTP sites specified in the README file (found in the libtiff directory on the CD) and replaced the old version with the new version. I couldn't do that with the JPEG library, because the main archive location of ftp//ftp.uu.net/ doesn't allow connections from dial-up hosts whose names don't resolve in DNS. So, I grabbed the source from the GIMP server (ftp//ftp.gimp.org/pub/libs/). The new versions built much more easily. I did not, however, install these libraries on my system, as I already had working versions installed. The /xiesamples directory hard codes the library paths to these image libraries (libtiff and libjpeg) to be relative to the samples directory. I simply built the libraries and then renamed the default directories (from the archive files) to the directories expected by the XIE CD software. After this, the CD software built fine.
The sample software under the /xiesamples directory covers most, if not all, examples from the text. Since all of the sample clients on the CD were written on Linux, they all built fine (after updating the two libraries described previously). Programs here are small examples of the base features of XIE as described in the text. From the README file on the CD:
Most of the samples work with gray-scale JPEGs, a few work with CCITT images stored in TIFF files, PGM, PPM, color JPEGs, or raw SingleBand (gray-scale) images.
Unfortunately, I had problems running these sample programs on my system. After rereading the README file, I discovered some of the samples work only on 8-bit PseudoColor visuals. I have my system running in TrueColor mode. Take a look at the README file for explanations of each sample; it will tell you if you can specify a visual and/or the type of color map to use. However, in my limited tests, the only sample program I was able to run under a TrueColor visual was the backendtest program.
Chapter 2 has a fairly good discussion on using Xlib for image manipulation for anyone who had problems understanding it from the O'Reilly Xlib manuals. This text is a programming guide, not a reference guide. To my knowledge, a printed reference guide for XIE is not yet available.
Throughout the text, Syd provides examples of how to make XIE API calls, including well-commented data structures used in the API. It's obvious Syd understands the ins and outs of the API. He provides extensive source code examples—I hardly went through three pages without seeing at least one snippet of code.
Plenty of gray-scale example images are printed in the text, and at least a few of these lose some of their impact without color. An eight-page color gallery is in the center of the book. However, these images are useful only for explaining some general graphics terminology and techniques and are not really descriptive of XIE itself.
I found Chapter 15 to be one of the best chapters simply because of its application to other graphics areas. Color space conversion is a common task and one that is not well-supported by many Linux graphics applications. For example, three paragraphs into this chapter, I learned that
YCbCr images represent color and luminosity as separate channels in the image. Humans are more sensitive to changes in luminosity than to changes in color, [so] compression algorithms can apply greater compression ratios to the color bands than are applied to the luminance band (Y) without degrading the perceptible quality of the image.
This sort of information, while explaining why certain color spaces are supported by XIE, also provides definitions that are applicable to other color management tools.
One issue not covered well in this text is how XIE might be used, if it can be used, with tools like OpenGL or Mesa. It might not make sense to combine the two, but there doesn't seem to be any mention of how XIE fits into the overall X11 collection of core features, extensions and third-party graphics libraries.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Devuan Beta Release
- May 2016 Issue of Linux Journal
- EnterpriseDB's EDB Postgres Advanced Server and EDB Postgres Enterprise Manager
- The US Government and Open-Source Software
- The Humble Hacker?
- The Death of RoboVM
- BitTorrent Inc.'s Sync
- Open-Source Project Secretly Funded by CIA
- New Container Image Standard Promises More Portable Apps
- AdaCore's SPARK Pro
In modern computer systems, privacy and security are mandatory. However, connections from the outside over public networks automatically imply risks. One easily available solution to avoid eavesdroppers’ attempts is SSH. But, its wide adoption during the past 21 years has made it a target for attackers, so hardening your system properly is a must.
Additionally, in highly regulated markets, you must comply with specific operational requirements, proving that you conform to standards and even that you have included new mandatory authentication methods, such as two-factor authentication. In this ebook, I discuss SSH and how to configure and manage it to guarantee that your network is safe, your data is secure and that you comply with relevant regulations.Get the Guide