Replacing the shutdown screen: Difference between revisions
Jump to navigation
Jump to search
(Link to bootanim page.) |
(Update the ppmto565 script, document the '-z' option.) |
||
Line 6: | Line 6: | ||
For example, you might wish to try: [http://dev.laptop.org/~cscott/modified-shutdown.565 modified-shutdown.565]. |
For example, you might wish to try: [http://dev.laptop.org/~cscott/modified-shutdown.565 modified-shutdown.565]. |
||
⚫ | |||
On a linux system, you can convert 1200x900 PNG images to 565-format images as follows: |
On a linux system, you can convert 1200x900 PNG images to 565-format images as follows: |
||
$ yum -y install netpbm-progs |
$ yum -y install netpbm-progs |
||
$ pngtopnm myfile.png | ./ppmto565.py |
$ pngtopnm myfile.png | ./ppmto565.py -z -o myfile.565 |
||
using the following python script named 'ppmto565.py': |
|||
<pre><nowiki> |
|||
#!/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 |
|||
Using the <code>ppmto565.py</code> script found at http://dev.laptop.org/~cscott/ppmto565.py |
|||
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) |
|||
</nowiki></pre> |
Revision as of 18:33, 29 June 2008
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.
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 -z -o myfile.565
Using the ppmto565.py
script found at http://dev.laptop.org/~cscott/ppmto565.py
On core OS versions prior to 8.2, you must omit the -z option. The resulting raw 565-format files seem large, but we use a compressing filesystem on the XO which slims them down nicely.