Replacing the shutdown screen

From OLPC
Revision as of 15:51, 13 June 2008 by CScott (talk | contribs) (Link to bootanim page.)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

See also: Tweaking the boot animation.

The UL warning image displayed during shutdown can be modified by replacing the file

/usr/share/boot-anim/ul_warning.565

with an appropriate alternative, in 1200x900 "565" format.

For example, you might wish to try: modified-shutdown.565.

Note that 565-format images seem very large, but we use a compressing filesystem which slims them down nicely.

On a linux system, you can convert 1200x900 PNG images to 565-format images as follows:

$ yum -y install netpbm-progs  
$ pngtopnm myfile.png | ./ppmto565.py > myfile.565

using the following python script named 'ppmto565.py':

#!/usr/bin/python2.5
"""Convert PPM-format images to 565-format."""
from __future__ import division, with_statement
import sys

def eat_comment(inf): # just read #, read until next EOL
    while True:
        c = inf.read(1)
        if c == '\n' or c == '\r': break # read to EOL
    return c

def read_token(inf):
    # eat up leading whitespace
    while True:
        c = inf.read(1)
        if c == '#': eat_comment(inf)
        elif not c.isspace(): break
    # now read in non-whitespace.
    s = c
    while True:
        c = inf.read(1)
        if c == '#': c = eat_comment(inf)
        if c.isspace(): break
        s += c
    # done!
    return s

def main(inf, outf):
    import struct
    # read ppm from input
    magic = inf.read(2)
    assert magic == 'P6'
    width = int(read_token(inf))
    height = int(read_token(inf))
    maxval = int(read_token(inf))
    unpackstr = '!3B' if maxval < 256 else '!3H'
    unpacklen = struct.calcsize(unpackstr)
    # write header
    outf.write(struct.pack('@IIP', width, height, 0))
    # read pixel data, convert, and write it to output
    def scale(x, y): return int((y*x/maxval)+0.5)
    for y in xrange(0, height):
        for x in xrange(0, width):
            red, green, blue = struct.unpack(unpackstr, inf.read(unpacklen))
            encoded = (scale(red, 0x1f) << 11) + \
                      (scale(green, 0x3f) << 5) + \
                      (scale(blue, 0x1f))
            outf.write(struct.pack('@H', encoded))

if __name__ == '__main__':
    import sys
    main(sys.stdin, sys.stdout)