Skip to content

May 26, 2009

1

How to create 8 bit colormap PNG image for usplash

by Joe Kuan

ubuntulogoI have both the libusplash-dev and libbogl-dev packages installed, followed the instruction in /usr/share/doc/libusplash-dev/examples to change eft-theme.c to my own theme, then followed the instructions in Usplash Customization Howto to install the new theme.

However, I still got a blank screen. It took me a while to figure out that it was the problem with the colormap of my splash PNG images. The utility pngtousplash doesn’t convert the image to C code properly.

pngtousplash

Looking inside the generated C image file, there is no color defined.

/* Palette data. */
static unsigned char itrinegy_live_splash_palette[0][3] = {
};

/* Pixmap structure. */
struct usplash_pixmap pixmap_itrinegy_live_splash = {
1024,     /* Width. */
768,      /* Height. */
0,        /* Number of colors. */
-1,       /* Transparent color. */
itrinegy_live_splash_palette, /* Palette. */
itrinegy_live_splash_data,    /* Data. */
};

By looking at the example images in /usr/share/doc/libusplash-dev/examples, those are 8 bit colormap images:

pngfile

So in order to convert the PNG image into 8 bit colormap, I used an utility ‘convert’ from the ImageMagick package.

converted png file

Then runs pngtousplash on the new image and the image C file is generated correctly. The palette is not empty and the number of colors is not zero.

/* Palette data. */
static unsigned char itrinegy_live_splash_new_palette[197][3] = {
  {0x00, 0x00, 0x00},
  .....
};

/* Pixmap structure. */
struct usplash_pixmap pixmap_itrinegy_live_splash_new = {
  1024,     /* Width. */
  768,      /* Height. */
  197,      /* Number of colors. */
  -1,       /* Transparent color. */
  itrinegy_live_splash_new_palette, /* Palette. */
  itrinegy_live_splash_new_data,    /* Data. */
};

To make sure whether usplash will load the splash screen successfully before starting the long process of writing into Live CD/USB, do

usplash -x 1024 -y 768

See my other blog on how to use usplash and usplash_write with your new splash screen.

I work for iTrinegy and here are my other technical blogs

Advertisements
1 Comment Post a comment
  1. Rajkumar
    Jan 11 2011

    Really helpful. Was looking to convert tiff image to 8 bit without losing colors in Imagemagick.

    Thanks a lot,
    Rajkumar Rajput

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

%d bloggers like this: