The basic process is:

  • Use a screen capture program like xv or GIMP to get a desired image of

approximately 32x32 size.

  • save the file with an XPM format
  • if you don't have xv or GIMP, you can use Netpbm
  • Use Netpbm routines to size and convert to XPM.
  • Insert the xpm into the gui/us_pixmaps.h file so it is available

to QIcon().

Not knowing how familiar you are with Netpbm, I'll be explicit. Most Linux distros these days have the package already installed. On my machine and on bcf, the component executables are in /usr/bin. All the routines deal with the PNM format that is a simple raster format handy for intermediate images. By default, input and output are via STDIN and STDOUT, so you can pipe from one executable to the next.

So, the detailed procedure is as follows.

Identify the image you want and capture it with a screen dump utility. Experiment around to get an image that is a little more than 32x32. It need not be square. But the 32 by 32 final image will be what is clipped from the upper left of what you start with. I'm assuming you get a PNG image file.

The command line will look something like the following.

        > pngtopnm icon-capture.png \
          | pamcut -width 32 -height 32 \
          | pnmdepth 31 \
          | ppmtoxpm >icon-final.xpm

The purpose of each is:

        pngtopnm                - convert PNG to intermediate PNM format
        pamcut                - grab leftmost 32 and uppermost 32 pixels
        pnmdepth                - insure limited colors to simplify 
eventual xpm
        ppmtoxpm                - convert from PNM to XPM

Once the final xpm file is as desired, it can be inserted into ~/ultrascan3/gui/us_pixmaps.h. The format of the lines should be as other entries in the header file, meaning chiefly that the line with

        static char* noname[] = {

gets changed to something like

        static const char* ras_xpm[] = {

and some of the comment lines from the xpm file can be removed.

Of course, there are other strategies for getting the color map and size as desired. You could, for example, scale instead of clip. You can browse

Last modified 8 years ago Last modified on Feb 14, 2012 2:47:23 PM