OLD | NEW |
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 # This adds text to our non-labeled recovery images. | 6 # This adds text to our non-labeled recovery images. |
7 # | 7 # |
8 # The source images should be 1366x800, with the expectation they'll be cropped | 8 # The source images should be 1366x800, with the expectation they'll be cropped |
9 # to 1366x768 or 1280x800, have 2 lines of text overlayed at the bottom, and | 9 # to 1366x768 or 1280x800, have 2 lines of text overlayed at the bottom, and |
10 # then be resized to 800x600 so that the BIOS can then display them stretched | 10 # then be resized to 800x600 so that the BIOS can then display them stretched |
(...skipping 21 matching lines...) Expand all Loading... |
32 tmpdir=$(mktemp -d /tmp/tmp.XXXXXXXXX) | 32 tmpdir=$(mktemp -d /tmp/tmp.XXXXXXXXX) |
33 trap "rm -rf $tmpdir" EXIT | 33 trap "rm -rf $tmpdir" EXIT |
34 img_orig="${tmpdir}/img_orig.bmp" | 34 img_orig="${tmpdir}/img_orig.bmp" |
35 img_crop_a="${tmpdir}/img_crop_a.bmp" | 35 img_crop_a="${tmpdir}/img_crop_a.bmp" |
36 img_crop_b="${tmpdir}/img_crop_b.bmp" | 36 img_crop_b="${tmpdir}/img_crop_b.bmp" |
37 img_txt_a="${tmpdir}/img_txt_a.bmp" | 37 img_txt_a="${tmpdir}/img_txt_a.bmp" |
38 img_txt_b="${tmpdir}/img_txt_b.bmp" | 38 img_txt_b="${tmpdir}/img_txt_b.bmp" |
39 label_file="${tmpdir}/label.txt" | 39 label_file="${tmpdir}/label.txt" |
40 | 40 |
41 # Output directories | 41 # Output directories |
42 outdir_a=$(dirname $0)/out_${geom_crop_a} | 42 thisdir=$(readlink -e $(dirname $0)) |
| 43 outdir_a=${thisdir}/out_${geom_crop_a} |
43 [ -d "$outdir_a" ] || mkdir -p "$outdir_a" | 44 [ -d "$outdir_a" ] || mkdir -p "$outdir_a" |
44 outdir_b=$(dirname $0)/out_${geom_crop_b} | 45 outdir_b=${thisdir}/out_${geom_crop_b} |
45 [ -d "$outdir_b" ] || mkdir -p "$outdir_b" | 46 [ -d "$outdir_b" ] || mkdir -p "$outdir_b" |
46 | 47 |
47 | 48 |
48 function find_background_color { | 49 function find_background_color { |
49 src_img=$1 | 50 src_img=$1 |
50 convert "$src_img" -crop '1x1+10+10!' txt:- | \ | 51 convert "$src_img" -crop '1x1+10+10!' txt:- | \ |
51 perl -n -e 'print "$1" if m/(#[0-9a-f]+)/i;' | 52 perl -n -e 'print "$1" if m/(#[0-9a-f]+)/i;' |
52 } | 53 } |
53 | 54 |
54 function process_one_file { | 55 function process_one_file { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 # Now scale the result to the final size | 101 # Now scale the result to the final size |
101 convert "$img_txt_a" -scale "$geom_final" -alpha off "$dst_img_a" | 102 convert "$img_txt_a" -scale "$geom_final" -alpha off "$dst_img_a" |
102 convert "$img_txt_b" -scale "$geom_final" -alpha off "$dst_img_b" | 103 convert "$img_txt_b" -scale "$geom_final" -alpha off "$dst_img_b" |
103 } | 104 } |
104 | 105 |
105 | 106 |
106 # Do it. | 107 # Do it. |
107 for file in originals/*.gif; do | 108 for file in originals/*.gif; do |
108 process_one_file "$file" | 109 process_one_file "$file" |
109 done | 110 done |
| 111 |
| 112 # Zip up the bitmaps |
| 113 (cd "$outdir_a" && zip -qr "${thisdir}/out_${geom_crop_a}.zip" *) |
| 114 (cd "$outdir_b" && zip -qr "${thisdir}/out_${geom_crop_b}.zip" *) |
OLD | NEW |