Bibek Paudel’s weblog

void man(Computing, South_Asia)

Use ImageMagick to change the GRUB splash screen

with 4 comments

When you have more than one operating systems installed, a boot loader (should) gives you the choice of the available operating systems you can boot into. GNU GRUB is a popular boot loader used in GNU/Linux systems. A GRUB splash screen is the image that appears behind the GRUB boot menu.

Ok. This article isn’t of much use except to show off in front of your friends who use a plain GRUB screen. But it doesn’t harm to keep your boot screen attractive. If you look beyond the splash screen part, you will come to realize the power of ImageMagick. What’s more, you can do image authoring right from the command line. A big help when you have to resize or convert the format of a large number of pictures.

“ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.”

  1. First check if you have ImageMagick installed. Get it, if it isn’t installed. I am using a Debian system where the command
    apt-get install imagemagick
    would install it. In a Fedora system, this would be
    yum install imagemagick
  2. For this example, I am taking a picture named photo.jpg. We can’t use this image directly as the splash image. A GRUB splash image has the following requirements:
    • .xpm.gz type file
    • 640×480 resolution
    • 14 colors only
  3. Now comes the power of imagemagick to easily create the image of our need. The command
    convert -resize 640×480 -colors 14 photo.jpg photo.xpm
    gives us the required .xpm format image.
  4. We now have to compress the .xpm image. The command
    gzip photo.xpm
    just does that.

    In fact, it is not necessary for the splash image to be of .xpm.gz format. It will work fine even with a .xpm image. Interestingly, compressed files load quicker into computer’s memory than uncompressed ones. Because of processing powers, today’s computers take lesser time to load a compressed file and uncompress it than to load an uncompressed file by reading a bigger area from the disk drive. Yes, that’s exactly why the compressed Linux kernel is loaded into the memory while booting.

  5. We now copy the file onto the grub directory.
    cp photo.xpm.gz /boot/grub/
  6. As a precautionary measure, we need to keep a backup of the GRUB configuration file. In Debian based systems, it is the /boot/grub/menu.lst file and in Red Hat based systems (Fedora included), it is the /boot/grub/grub.conf file.
  7. The final step in the process is to edit our GRUB configuration file. Find the line that contains the word “splashimage” and add edit the address of the image. If the line doesn’t exist, simple add a line similar to the one below, somewhere below the initial commented lines:
    splashimage=(hd0,0)/boot/grub/photo.xpm.gz
    (hd0,0) corresponds to the Debian partition on my computer. It may be different in yours.
  8. Now save the GRUB configuration file and restart your system.

Tell me if this comes to any use for you.

Written by Bibek Paudel

February 4, 2008 at 2:58 am

4 Responses

Subscribe to comments with RSS.

  1. very good information .I will try it once. Your blogs look quite informative and interesting to me

    Saurabh Thakur

    February 4, 2008 at 3:21 am

  2. There’s also a nice splashy documentation for Ubuntu @ https://help.ubuntu.com/community/USplash

    Good stuff Bibek! ;)

    nepbabu

    February 7, 2008 at 9:28 pm

  3. Thank you for very interesting post……

    Balakumar

    May 15, 2008 at 11:05 pm

  4. this is not working with -resize option…
    this convert command only convert a jpg to xpm file…
    but not convert resize or color option….
    tell me some other option or tool

    Sorry for my bad english…..

    bharat lal

    March 10, 2009 at 11:10 am


Leave a Reply